2 ms·
string is a typedef of the template basic_string so you don't have to type as much I assume.
by rightbyte 7y ago
string is a typedef of the template basic_string so you don't have to type as much I assume.
- axilmar 7y agoIt 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; }