I want a second copy of an std::vector
in which all elements are inverted, e.g. 0x01
in the first vector should be 0xFE
in the second.
Is this a good solution?
std::vector<uint8_t> first_list = {0x01, 0x10, 0x32, 0x1A };
std::vector<uint8_t> second_list = first_list;
for(std::vector<uint8_t>::iterator it = second_list.begin(); it != second_list.end(); ++it)
*it = ~*it;
The for loop sticks out to me as unnecessarily verbose.