October 10th, 2013, 08:42 AM
Re: std::string to std::vector<TCHAR> with terminator
"specs" :s (I will reserve to keep to myself any impressions on the mental sanity of whomever wrote those specs.)
Originally Posted by 2kaud
It's fine if the compiler optimizes to it, but can't write them myself.
Nope, needs to work among others on VS2010 and an older version of GCC. so I can't assume full C++11 compliance.
Originally Posted by superbonzo
Yes, Even mentioned this before.
anyway, did you considered codeplug's reserve+assign+c_str suggestion ? I think you could even spare the reserve call ( being the const char* returned by c_str() random access iterators, the reserve should be done automatically, but I'm not sure though ... )
THe problem being that a std::string does not usually have a terminator, and calling c_str() could cause a realloc to insert it, which is the whole thing I'm trying to avoid.
Yes, but see above.
Originally Posted by Codeplug
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!