I have found that it's possible to declare such std::multimap:
multimap < u_int32_t, u_int32_t,string> lines;
If it's possible to declare it then it should be possible to insert too
But I wonder how?
I have tried std::pair
, but it seems I need something like std::triple
.
I know it's possible to decrale some struct and hold into that struct a few values. But I would rather prefer to do it directly. Moreover because it's possible to declare it.
EDIT
I did serious mistake and it turned out I really understood multimap wrong.
Screams of people here and downvotes made me to reread documentation.
Now I use it so:
struct container {
u_int32_t size_in_blocks;
string name_of_file;
};
//size_of_file
multimap < u_int32_t, container> lines;
// first value is used as a key for sorting
// second value is just a storage
container d;// initialization
lines.insert ( std::pair<u_int32_t,container>( total_size_bytes, d) );
Thanks all!