//Purpose: // Test binding_of // #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; unsigned value_instances=0; template struct ph_value { typedef ph_value type; virtual ~ph_value(){} unsigned my_instance; ph_value():my_instance(value_instances++){} ph_value(const ph_value&):my_instance(value_instances++){} }; template std::ostream& operator<< ( std::ostream&sout , ph_valueconst&x ) { sout<<"ph_value<"<.my_instance="< a_type; typedef mpl::vector < destructible<_a> #define HARDCODE_CTOR_ARG #ifdef HARDCODE_CTOR_ARG , constructible<_a(const a_type&)> #else , constructible<_a(const _a&)> #endif , typeid_<_a> > ConceptA; typedef mpl::map < mpl::pair<_a, a_type> > bindings_map_t; static_binding bindings_map_v=make_binding(); typedef any < ConceptA , _a > AnyA; a_type a_valu; std::cout<<"a_valu=" <(a_fst); std::cout<<"fst_cast=" < bindings_con_t; bindings_con_t const& bindings_fst_v=binding_of(a_fst); std::cout<<"creating a_dup\n"; AnyA a_dup ( bindings_fst_v #define A_DUP_VALUE #ifdef A_DUP_VALUE , a_valu #else , a_fst #endif ) ; std::cout<<"a_dup=" <(a_dup) <<"\n"; #endif return 0; }