std::string has an identical constructor to the one you use for vector. The only reason not to use it is if there is a chance that &buf doesn't correctly access the entire string.
The main reason is because I can control its size to make sure there is no buffer overrun. The string's length is not fixed. Plus the OP's original code is prove to buffer overruns because no check is made to ensure the length is < 32.
Although, std::string is not guaranteed to be contiguous, that is of no concern since we're storing a C-style string which is guaranteed to be contiguous and nul-terminated. Similarly, when we read back, it will construct a new string from the C-style string.