c++ - Is there a container ordered by primary and secondary keys? -


i looking qmultimap qt library, 2 keys.

i able these things:

template<tprimarykey, tsecondarykey, titem> class container; ... container<int, int, std::string> container; container.insert(2, 2, "pear"); container.insert(1, 1, "apple"); container.insert(1, 2, "orange"); (auto = container.begin(); != container.end(); ++it)     std::cout << *it << std::endl; 

and output be:

apple orange pear 

that items sorted according tprimarykey , when there more items same tprimarykey sorted tsecondarykey.

is there freely available container similar functionality?

for stl, make map key pair:

std::map< std::pair<int, int>, std::string > container; 

you might still able use pair qt container, though won't have quite same interface suggested.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -