(You forgot to specify the type of the std::vector element. I assume unsigned char .)
In C ++ 0x you can write:
std::vector<unsigned char> v{ 0x0C, 0xD4, 0x30 };
In C ++ 03 you should write:
std::vector<unsigned char> v; v.push_back(0x0C); v.push_back(0xD4); v.push_back(0x30);
Or, if you don't mind using space:
unsigned char values[] = { 0x0C, 0xD4, 0x30 }; std::vector<unsigned char> v(values, values+3);
You can also see boost.assign .
source share