3 ms·
If you are using C++, you can make this a lot easier using this template alias template<typename T> using ptr = T*; ptr<const char> str: const ptr
by jbandela1 5y ago
If you are using C++, you can make this a lot easier using this template alias
template<typename T>
using ptr = T*;
ptr<const char> str:
const ptr<char> pchar;
ptr<void(ptr<const char>)> fun_ptr;
Basically this simple trick removes most of the confusion, and you can read the types left to right.
- jcelerier 5y agoIt also makes function pointer types much clearer: using func_ptr = float(int); // Given float some_func(int); // Then func_ptr* a = &some_func; // Also func_ptr* b = [] (int x) { return 0.f; };