Hmm. That seems almost as bad as doing it manually. And portability is a pretty high priority. Pointers are a definite option, since vectors are contiguous I could use it as a char array and interpret it as anything, but I was hoping to avoid that.
Also, pulling an int out of the vector was just one case, there are several other data types I need to pull out, such as strings (preferably std::string).
One option was to read it as a struct vector instead of char vector, but the data contains variable-length text strings, which makes that just as complex.
I suppose I could always do something like:
vector<char> buffer;int *data = &buffer[28];int value = *data;
But it seems very round-about. Is there no standard way of doing this?