I know I can set a custom allocator for vectors using the syntax vector<T, Alloc>. Is there a way I can do the same for strings?
I know I can set a custom allocator for vectors using the syntax vector<T,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. All string classes come from the class template
basic_string, declared as such:For example,
std::stringis justtypedef basic_string<char> string;.The third template parameter is the allocator, so you can do something like: