#include #include #include #include #include #include namespace b = boost; namespace bf = boost::fusion; namespace demo { struct employee { std::string name; int age; }; } // demo::employee is now a Fusion sequence BOOST_FUSION_ADAPT_STRUCT( demo::employee, (std::string, name) (int, age)) int main(void) { typedef bf::vector V1; // Find against non-const V1 V1 v1(1,2.0); BOOST_MPL_ASSERT_NOT(( b::is_same::type,bf::result_of::end::type> )); assert(*bf::find(v1) == 1); // Find against const V1 const V1 const_v1(3,4.0); BOOST_MPL_ASSERT_NOT(( b::is_same::type,bf::result_of::end::type> )); assert(*bf::find(const_v1) == 3); // Find against non-const employee demo::employee e1 = {"Foo",18}; BOOST_MPL_ASSERT_NOT(( b::is_same::type,bf::result_of::end::type> )); assert(*bf::find(e1) == 18); // Find against const employee const demo::employee const_e1 = {"Bar",21}; #if 0 BOOST_MPL_ASSERT_NOT(( b::is_same::type,bf::result_of::end::type> )); assert(*bf::find(const_e1) == 21); #else // note that the find key is a const int BOOST_MPL_ASSERT_NOT(( b::is_same::type,bf::result_of::end::type> )); assert(*bf::find(const_e1) == 21); #endif return 0; }