//delimit_macro_test_code //Purpose: // A slight simplification of crtp_test.cpp to // isolate the reason why ctor args, other than // for the 1st bound type, done't seem to work. // #include "libs/io/filters/src/mout.cpp" //#define UTILITY_OBJECT_TRACKED_SET_OF_OBJECTS_TRACE_MODE //#define UTILITY_OBJECT_TRACKED_TRACE_MODE #include "libs/utility/src/obj_id.cpp" #include "libs/utility/src/object_tracked.cpp" #include "boost/utility/trace_scope.hpp" #if 0 #include #else #include "variant.hpp" #endif using namespace boost; template < unsigned TypeId > struct type_id : utility::object_tracked { static unsigned const our_tid = TypeId ; type_id(void) { mout()<<"type_id(void):tid="<const&) { mout()<<"type_id(type_idconst&):tid="< const& a_tid ) { return sout<<"type_id<"<const&:obj_id="< , type_id<2> > { variant < type_id<1> , type_id<2> > super_type ; vlist(void) { utility::trace_scope ts("vlist(void)"); mout()<<"id="<id_get()<<"\n"; } template < class T > vlist(T const& a_t) : super_type(a_t) { utility::trace_scope ts("templatevlist(T const&)"); mout()<<"id="<id_get()<<"\n"; mout()<<"this->which="<which()<<"\n"; } template < class T > vlist(T& a_t) : super_type(a_t) { utility::trace_scope ts("templatevlist(T&)"); mout()<<"id="<id_get()<<"\n"; mout()<<"this->which="<which()<<"\n"; } vlist(type_id<2>& a_t) : super_type(a_t) { utility::trace_scope ts("templatevlist(type_id<2>&)"); mout()<<"id="<id_get()<<"\n"; mout()<<"this->which="<which()<<"\n"; } vlist(type_id<2>const& a_t) : super_type(a_t) { utility::trace_scope ts("templatevlist(type_id<2>const&)"); mout()<<"id="<id_get()<<"\n"; mout()<<"this->which="<which()<<"\n"; } }; unsigned const arg_id=2; void test_list(void) { utility::trace_scope ts("test_list"); typedef vlist list_type; typedef type_id arg_type; arg_type a_arg; { utility::trace_scope ts("list_1 scope"); list_type list_1(a_arg); mout()<<"list_1.which()="<,type_id > list_type; typedef type_id arg_type; arg_type a_arg; { utility::trace_scope ts("list_1 scope"); list_type list_1(a_arg); mout()<<"list_1.which()="<