3 ms·
It would be nice if this worked: template <class T = char> class string { ... }; string s = "a";
by axilmar 7y ago
It would be nice if this worked:
template <class T = char> class string { ... };
string s = "a";
- rightbyte 7y agoIt does with newer compilers. Was some bugs with gcc and clang earlier. Try: #include <cstdio> template <class T = char> class string { public: string(const T *const c) : c_ptr(c){} const T *const c_ptr; }; int main() { string s = "qwe"; printf("%s", s.c_ptr); return 0; }