//Purpose: // Test rebind_any // #include #include #include #include #include #include #include #include #include //#define USE_DEMANGLED #ifdef USE_DEMANGLED #include #define DEMANGLE_TYPE(TYPE) utility::demangled_type_name() #define DEMANGLE_EXPR(EXPR) utility::demangled_type_name(EXPR) #else #include #define DEMANGLE_TYPE(TYPE) typeid(TYPE).name() #define DEMANGLE_EXPR(EXPR) DEMANGLE_TYPE(EXPR) #endif namespace mpl = boost::mpl; using namespace boost::type_erasure; template struct value { typedef //#define USE_VALUE_T #ifdef USE_VALUE_T value #else double #endif type; }; int main() { typedef mpl::vector< copy_constructible<_a>, copy_constructible<_b> > ConceptAB; std::cout<<"ConceptAB=" <::type=" <::type) <<"\n"; std::cout<<"value<_b>::type=" <::type) <<"\n"; typedef mpl::map< mpl::pair<_a, value<_a>::type >, mpl::pair<_b, value<_b>::type > > bindings_map_t; static_binding bindings_made=make_binding(); typedef any< ConceptAB, _b > AnyB; std::cout<<"creating b_any\n"; value<_b>::type b_valu; AnyB b_any(b_valu,bindings_made); typedef binding ab_binding_t; ab_binding_t const& b_binding=binding_of(b_any); std::cout<<"b_binding=" < AnyA; std::cout<<"creating a_any\n"; value<_a>::type a_valu; AnyA a_any //#define USE_B_BINDING #ifdef USE_B_BINDING ( b_binding,a_valu) #else ( a_valu,bindings_made) #endif ; ab_binding_t const&a_binding=binding_of(a_any); std::cout<<"a_binding=" <