T
Danke für den Hinweis!
Hier meine Testimplementierung. Bin noch am Herausfinden, wie ich mit der Funktion "modify()" arbeiten kann.
http://www.highscore.de/cpp/boost/container.html#container_multiindex
#include <iostream> // NOLINT
#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/composite_key.hpp>
struct entry {
std::string path;
std::string a;
std::string b;
std::string c;
entry(const std::string& path, const std::string& a,
const std::string& b, const std::string& c) : path(path), a(a),
b(b), c(c) {
}
friend std::ostream& operator<<(std::ostream& os, const entry& e) {
os << e.path << "\n" << e.a << "\n" << e.b << "\n" << e.c << "\n";
return os;
}
};
typedef boost::multi_index::multi_index_container<
entry,
boost::multi_index::indexed_by<
boost::multi_index::hashed_non_unique<
boost::multi_index::member<entry, std::string, &entry::path>
>,
boost::multi_index::hashed_non_unique<
boost::multi_index::composite_key<
entry,
boost::multi_index::member<entry, std::string, &entry::a>,
boost::multi_index::member<entry, std::string, &entry::b>,
boost::multi_index::member<entry, std::string, &entry::c>
>
>
>
> entry_bimap;
int main() {
entry_bimap eb;
eb.insert(entry("a.exe", "11", "22", "33"));
eb.insert(entry("b.exe", "44", "55", "66"));
eb.insert(entry("c.exe", "77", "88", "99"));
std::cout << *eb.find("b.exe") << "\n";
std::cout << *eb.get<1>().find(boost::make_tuple("77", "88", "99")) << "\n";
const crc_bimap::nth_index<1>::type& x = eb.get<1>();
std::cout << *x.find(boost::make_tuple("44", "55", "66")) << "\n";
return 0;
}