sl@0: /* Used in Boost.MultiIndex tests. sl@0: * sl@0: * Copyright 2003-2006 Joaquín M López Muñoz. sl@0: * Distributed under the Boost Software License, Version 1.0. sl@0: * (See accompanying file LICENSE_1_0.txt or copy at sl@0: * http://www.boost.org/LICENSE_1_0.txt) sl@0: * sl@0: * See http://www.boost.org/libs/multi_index for library home page. sl@0: */ sl@0: sl@0: #ifndef BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP sl@0: #define BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP sl@0: sl@0: #include /* keep it first to prevent nasty warns in MSVC */ sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: struct employee sl@0: { sl@0: int id; sl@0: std::string name; sl@0: int age; sl@0: int ssn; sl@0: sl@0: employee(int id_,std::string name_,int age_,int ssn_): sl@0: id(id_),name(name_),age(age_),ssn(ssn_) sl@0: {} sl@0: sl@0: bool operator==(const employee& x)const sl@0: { sl@0: return id==x.id&&name==x.name&&age==x.age; sl@0: } sl@0: sl@0: bool operator<(const employee& x)const sl@0: { sl@0: return id (const employee& x)const{return x<*this;} sl@0: bool operator>=(const employee& x)const{return !(*this >, sl@0: boost::multi_index::hashed_non_unique< sl@0: boost::multi_index::tag, sl@0: BOOST_MULTI_INDEX_MEMBER(employee,std::string,name)>, sl@0: boost::multi_index::ordered_non_unique< sl@0: boost::multi_index::tag, sl@0: BOOST_MULTI_INDEX_MEMBER(employee,int,age)>, sl@0: boost::multi_index::sequenced< sl@0: boost::multi_index::tag >, sl@0: boost::multi_index::hashed_unique< sl@0: boost::multi_index::tag, sl@0: BOOST_MULTI_INDEX_MEMBER(employee,int,ssn)>, sl@0: boost::multi_index::random_access< sl@0: boost::multi_index::tag > > sl@0: {}; sl@0: sl@0: typedef sl@0: boost::multi_index::multi_index_container< sl@0: employee, sl@0: employee_set_indices> employee_set; sl@0: sl@0: #if defined(BOOST_NO_MEMBER_TEMPLATES) sl@0: typedef boost::multi_index::nth_index< sl@0: employee_set,1>::type employee_set_by_name; sl@0: #else sl@0: typedef employee_set::nth_index<1>::type employee_set_by_name; sl@0: #endif sl@0: sl@0: typedef boost::multi_index::index< sl@0: employee_set,age>::type employee_set_by_age; sl@0: typedef boost::multi_index::index< sl@0: employee_set,as_inserted>::type employee_set_as_inserted; sl@0: typedef boost::multi_index::index< sl@0: employee_set,ssn>::type employee_set_by_ssn; sl@0: sl@0: #if defined(BOOST_NO_MEMBER_TEMPLATES) sl@0: typedef boost::multi_index::index< sl@0: employee_set,randomly>::type employee_set_randomly; sl@0: #else sl@0: typedef employee_set::index< sl@0: randomly>::type employee_set_randomly; sl@0: #endif sl@0: sl@0: #endif