lundi 23 juillet 2018

Creating a sub-vector from a vector reversed

I am currently taking a subset of std::vector<unsigned char> reply and handing it off to a function:

str = hexStr( std::vector<unsigned char> ( reply.begin() + 30, 
                                           reply.begin() + 32 ) )

What I have works, however, I want to reverse the order of the indices. I know this can be done with std::vector::rbegin or std::reverse_iterator::reverse_iterator, but I'm having trouble making it work in one pretty line.

Aucun commentaire:

Enregistrer un commentaire