From bb48c54f1080874f5a10907714f5fbae0b985ce9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Sep 2012 12:02:30 +0200 Subject: Add support for Boost Multi-Index container in Boost profile --- boost/common/multi-index/test.hxx | 114 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 boost/common/multi-index/test.hxx (limited to 'boost/common/multi-index/test.hxx') diff --git a/boost/common/multi-index/test.hxx b/boost/common/multi-index/test.hxx new file mode 100644 index 0000000..4018b61 --- /dev/null +++ b/boost/common/multi-index/test.hxx @@ -0,0 +1,114 @@ +// file : boost/common/multi-index/test.hxx +// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include +#include +#include +#include +#include +#include + +#include + +namespace mi = boost::multi_index; + +#pragma db value +struct comp +{ + comp () {} + comp (int n, const std::string& s) : num (n), str (s) {} + + #pragma db column("number") + int num; + std::string str; +}; + +inline bool +operator== (const comp& x, const comp& y) +{ + return x.num == y.num && x.str == y.str; +} + +typedef +mi::multi_index_container< + int, + mi::indexed_by > +> int_lst; + +typedef +mi::multi_index_container< + int, + mi::indexed_by > +> int_vec; + +typedef +mi::multi_index_container< + int, + mi::indexed_by > > +> int_set; + +typedef +mi::multi_index_container< + int, + mi::indexed_by< + mi::sequenced<>, + mi::ordered_unique > + > +> int_lst_set; + +typedef +mi::multi_index_container< + comp, + mi::indexed_by< + mi::ordered_unique >, + mi::random_access<> + > +> comp_set_vec; + +typedef +mi::multi_index_container< + comp, + mi::indexed_by< + mi::ordered_unique >, + mi::ordered_unique > + > +> comp_set_set; + +#pragma db object +struct object +{ + object () {} + object (const std::string& id): id (id) {} + + #pragma db id + std::string id; + + int_lst il; + int_lst iv; + int_set is; + + int_lst_set ils; + comp_set_vec csv; + comp_set_set css; +}; + +inline bool +operator== (const object& x, const object& y) +{ + return + x.id == y.id && + + x.il == y.il && + x.iv == y.iv && + x.is == y.is && + + x.ils == y.ils && + x.csv == y.csv && + x.css == y.css; +} + +#endif // TEST_HXX -- cgit v1.1