#includeusing CryptoPP::byte; using CryptoPP::SecByteBlock; typedef std::vector ByteVector; int main() { ByteVector bv{0x01, 0x02, 0x03, 0x04}; for (ByteVector::const_iterator it = bv.begin(); it != bv.end(); ++it) std::cout << std::hex << static_cast (*it) << " "; }
#includeIn this example, we create a ByteVector that contains the values 0x01, 0x02, 0x03, and 0x04. We use the ByteVector erase method and the begin method to remove the value 0x02 from the vector. We then use a range-based for loop to iterate over the modified vector and print each value in hexadecimal. The package library used in these examples is Crypto++ for C++.using CryptoPP::byte; using CryptoPP::SecByteBlock; typedef std::vector ByteVector; int main() { ByteVector bv{0x01, 0x02, 0x03, 0x04}; bv.erase(bv.begin() + 1); // remove 0x02 for (byte b : bv) std::cout << std::hex << static_cast (b) << " "; }