Is it possible to initialize a std::string with a character array, not
neccessarily null terminated? I.E. Given something like this:
char buffer[5];
buffer[0] = 0x01;
buffer[1] = 0x00;
buffer[2] = 'A';
buffer[3] = 'B';
buffer[4] = 'C';
The only way I know to do it now is to create a std::string and with a for
loop add each character. Is there some other, better way? I mean, I would
love to be able to say:
std::string Buffer( buffer, 5 );
Oh, you gotta be joking me! I just tried that just for the heck of it, and
it compiles and does exactly as I expect! O.o