diff -r 000000000000 -r bde4ae8d615e os/ossrv/stdcpp/tsrc/Boost_test/multi_index/inc/employee.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/multi_index/inc/employee.hpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,119 @@ +/* Used in Boost.MultiIndex tests. + * + * Copyright 2003-2006 Joaquín M López Muñoz. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * See http://www.boost.org/libs/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP +#define BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP + +#include /* keep it first to prevent nasty warns in MSVC */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct employee +{ + int id; + std::string name; + int age; + int ssn; + + employee(int id_,std::string name_,int age_,int ssn_): + id(id_),name(name_),age(age_),ssn(ssn_) + {} + + bool operator==(const employee& x)const + { + return id==x.id&&name==x.name&&age==x.age; + } + + bool operator<(const employee& x)const + { + return id (const employee& x)const{return x<*this;} + bool operator>=(const employee& x)const{return !(*this >, + boost::multi_index::hashed_non_unique< + boost::multi_index::tag, + BOOST_MULTI_INDEX_MEMBER(employee,std::string,name)>, + boost::multi_index::ordered_non_unique< + boost::multi_index::tag, + BOOST_MULTI_INDEX_MEMBER(employee,int,age)>, + boost::multi_index::sequenced< + boost::multi_index::tag >, + boost::multi_index::hashed_unique< + boost::multi_index::tag, + BOOST_MULTI_INDEX_MEMBER(employee,int,ssn)>, + boost::multi_index::random_access< + boost::multi_index::tag > > +{}; + +typedef + boost::multi_index::multi_index_container< + employee, + employee_set_indices> employee_set; + +#if defined(BOOST_NO_MEMBER_TEMPLATES) +typedef boost::multi_index::nth_index< + employee_set,1>::type employee_set_by_name; +#else +typedef employee_set::nth_index<1>::type employee_set_by_name; +#endif + +typedef boost::multi_index::index< + employee_set,age>::type employee_set_by_age; +typedef boost::multi_index::index< + employee_set,as_inserted>::type employee_set_as_inserted; +typedef boost::multi_index::index< + employee_set,ssn>::type employee_set_by_ssn; + +#if defined(BOOST_NO_MEMBER_TEMPLATES) +typedef boost::multi_index::index< + employee_set,randomly>::type employee_set_randomly; +#else +typedef employee_set::index< + randomly>::type employee_set_randomly; +#endif + +#endif