Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52848 - in sandbox/mirror: boost/mirror boost/mirror/detail boost/mirror/factory/wx_constructor_gui libs/mirror/example/factories
From: chochlik_at_[hidden]
Date: 2009-05-08 06:16:59


Author: matus.chochlik
Date: 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
New Revision: 52848
URL: http://svn.boost.org/trac/boost/changeset/52848

Log:
[mirror 0.4.x]
- update of the meta-function/factory/function_caller facilities

Text files modified:
   sandbox/mirror/boost/mirror/detail/function_meta_data.hpp | 37 ++++++++++
   sandbox/mirror/boost/mirror/factory.hpp | 23 +++--
   sandbox/mirror/boost/mirror/factory/wx_constructor_gui/manager.hpp | 11 +-
   sandbox/mirror/boost/mirror/functor_call.hpp | 146 +++++++++++++++++++++++----------------
   sandbox/mirror/boost/mirror/meta_constructors.hpp | 4
   sandbox/mirror/boost/mirror/meta_mem_functions.hpp | 68 ++++++++++++++----
   sandbox/mirror/libs/mirror/example/factories/input_ui.hpp | 32 ++++----
   sandbox/mirror/libs/mirror/example/factories/inserter.cpp | 78 +++++----------------
   sandbox/mirror/libs/mirror/example/factories/person.hpp | 11 +++
   sandbox/mirror/libs/mirror/example/factories/tetrahedron.cpp | 3
   10 files changed, 241 insertions(+), 172 deletions(-)

Modified: sandbox/mirror/boost/mirror/detail/function_meta_data.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/function_meta_data.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/function_meta_data.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -216,6 +216,29 @@
 ) BOOST_PP_COMMA_IF(PARAM_INDEX) BOOST_PP_SEQ_HEAD(TYPE_AND_NAME)
 
 
+/** Helper macro which expands into the type and name of the j-th parameter
+ * preceeded by a comma if it is not the first parameter
+ */
+#define BOOST_MIRROR_REG_META_FUNCTION_EXTRACT_PARAM_TYPE_AND_NAME( \
+ R, X, \
+ PARAM_INDEX, \
+ TYPE_AND_NAME \
+) BOOST_PP_COMMA_IF(PARAM_INDEX) \
+ BOOST_PP_SEQ_HEAD(TYPE_AND_NAME) \
+ BOOST_PP_SEQ_TAIL(TYPE_AND_NAME)
+
+
+/** Helper macro which expands into the name of the j-th parameter
+ * preceeded by a comma if it is not the first parameter
+ */
+#define BOOST_MIRROR_REG_META_FUNCTION_EXTRACT_PARAM_NAME( \
+ R, X, \
+ PARAM_INDEX, \
+ TYPE_AND_NAME \
+) BOOST_PP_COMMA_IF(PARAM_INDEX) \
+ BOOST_PP_SEQ_TAIL(TYPE_AND_NAME)
+
+
 
 /** Calls the BOOST_MIRROR_REG_META_FUNCTION_PARAM_NAME macro
  * in repetitions.
@@ -308,6 +331,20 @@
                 PARAM_SEQ \
         )
 
+#define BOOST_MIRROR_REG_META_FUNCTION_ENUM_PARAM_TYPES_AND_NAMES(PARAM_SEQ) \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_REG_META_FUNCTION_EXTRACT_PARAM_TYPE_AND_NAME, \
+ 0, \
+ PARAM_SEQ \
+ )
+
+#define BOOST_MIRROR_REG_META_FUNCTION_ENUM_PARAM_NAMES(PARAM_SEQ) \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_REG_META_FUNCTION_EXTRACT_PARAM_NAME, \
+ 0, \
+ PARAM_SEQ \
+ )
+
 #define BOOST_MIRROR_REG_META_FUNCTION_DEFINE_PARAM_TYPELIST( \
         FUNC_INDEX, \
         PARAM_SEQ \

Modified: sandbox/mirror/boost/mirror/factory.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/factory.hpp (original)
+++ sandbox/mirror/boost/mirror/factory.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -69,7 +69,7 @@
         constructor(Param param)
         { }
 
- inline Product operator()(void)
+ inline Product operator()(void)
         {
                 return Product();
         }
@@ -81,13 +81,18 @@
 typename constructor_utils::template adjust_product< \
                 typename mpl::at<TYPELIST, mpl::int_<INDEX> >::type \
>::type \
-> _##INDEX;
+> BOOST_PP_CAT(_, INDEX);
 
 #define BOOST_MIRROR_INITIALIZE_CONSTRUCTOR_MANUFACTURER(Z, INDEX, PARAM)\
-_##INDEX (PARAM, _meta_constructors, ConstructorIndex(), mpl::int_<INDEX>())
+BOOST_PP_CAT(_, INDEX) ( \
+ PARAM, \
+ _meta_constructors, \
+ ConstructorIndex(), \
+ mpl::int_<INDEX>()\
+)
 
 #define BOOST_MIRROR_CALL_CONSTRUCTOR_MANUFACTURER(Z, INDEX, X)\
-_##INDEX ()
+BOOST_PP_CAT(_, INDEX) ()
 
 
 /** Constructor with arguments
@@ -231,8 +236,8 @@
         ) \
  \
         template <typename Param> \
- base_factory(Param param, int factory_index) \
- : manager(param, factory_index) \
+ base_factory(Param param) \
+ : manager(param) \
                 BOOST_PP_REPEAT( \
                         PARAM_COUNT, \
                         BOOST_MIRROR_INITIALIZE_FACTORY_CONSTRUCTOR, \
@@ -330,12 +335,12 @@
                 base_class;
 
         factory(void)
- : base_class(0, 0)
+ : base_class(0)
         { }
 
         template <typename Param>
- factory(Param param, int factory_index = 0)
- : base_class(param, factory_index)
+ factory(Param param)
+ : base_class(param)
         { }
 };
 

Modified: sandbox/mirror/boost/mirror/factory/wx_constructor_gui/manager.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/factory/wx_constructor_gui/manager.hpp (original)
+++ sandbox/mirror/boost/mirror/factory/wx_constructor_gui/manager.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -57,8 +57,7 @@
         // the book ctrl
         BookCtrl* book_ctl;
         static inline BookCtrl* make_book_ctl(
- wx_constructor_gui_data* parent_data,
- int factory_index
+ wx_constructor_gui_data* parent_data
         )
         {
                 assert(parent_data != 0);
@@ -117,11 +116,9 @@
         };
 
 public:
- wx_constructor_gui(
- wx_constructor_gui_data* data,
- int factory_index
- ): parent_data(data)
- , book_ctl(make_book_ctl(parent_data, factory_index))
+ wx_constructor_gui( wx_constructor_gui_data* data)
+ : parent_data(data)
+ , book_ctl(make_book_ctl(parent_data))
         { }
 
         template <class Product, class ConstructorIndex>

Modified: sandbox/mirror/boost/mirror/functor_call.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/functor_call.hpp (original)
+++ sandbox/mirror/boost/mirror/functor_call.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -17,72 +17,83 @@
 namespace detail {
 
 template <
- template <class> class Manufacturer,
- class ParamTypeList,
- class ParamCount
+ template <class> class Manufacturer,
+ class MetaFunctions,
+ class FuncIndex,
+ class ParamCount
> struct base_functor_caller;
 
-#define BOOST_MIRROR_BASE_FUNCTION_CALLER_DECLARE_FACTORY(Z, INDEX, X)\
- factory<Manufacturer, typename mpl::at<ParamTypeList, mpl::int_< INDEX > >::type> \
- BOOST_PP_CAT(_, INDEX);
 
+#define BOOST_MIRROR_BASE_FUNCTION_CALLER_DECLARE_FACTORY(Z, INDEX, X)\
+Manufacturer< \
+typename constructor_utils::template adjust_product< \
+ typename meta_function::params:: \
+ template param< mpl::int_< INDEX > >:: \
+ type::reflected_type \
+>::type \
+> BOOST_PP_CAT(_, INDEX);
 
 #define BOOST_MIRROR_BASE_FUNCTION_CALLER_INITIALIZE_FACTORY(Z, INDEX, PARAM) \
- , BOOST_PP_CAT(_, INDEX) (PARAM, INDEX)
+ , BOOST_PP_CAT(_, INDEX) ( \
+ PARAM, \
+ _meta_functions, \
+ FuncIndex(), \
+ mpl::int_< INDEX >() \
+ )
 
 #define BOOST_MIRROR_BASE_FUNCTION_CALLER_CALL_FACTORY(Z, INDEX, X) \
- BOOST_PP_CAT(_, INDEX)()
+ BOOST_PP_CAT(_, INDEX)()
 
 
 #define BOOST_MIRROR_IMPLEMENT_BASE_FUNCTION_CALLER(PARAM_COUNT) \
 template < \
- template <class> class Manufacturer, \
- class ParamTypeList \
-> struct base_functor_caller<Manufacturer, ParamTypeList, mpl::int_<PARAM_COUNT> > \
+ template <class> class Manufacturer, \
+ class MetaFunctions, \
+ class FuncIndex \
+> struct base_functor_caller< \
+ Manufacturer, \
+ MetaFunctions, \
+ FuncIndex, \
+ mpl::int_<PARAM_COUNT> \
+> : constructor_utils \
 { \
- struct { } _dummy; \
- BOOST_PP_REPEAT( \
- PARAM_COUNT, \
- BOOST_MIRROR_BASE_FUNCTION_CALLER_DECLARE_FACTORY, \
- 0 \
- ) \
+protected: \
+ typedef typename MetaFunctions:: \
+ template function< FuncIndex > meta_function; \
+ \
+ MetaFunctions _meta_functions; \
+ BOOST_PP_REPEAT( \
+ PARAM_COUNT, \
+ BOOST_MIRROR_BASE_FUNCTION_CALLER_DECLARE_FACTORY, \
+ 0 \
+ ) \
  \
- template <class Param> \
- base_functor_caller(Param param) \
- : _dummy() \
- BOOST_PP_REPEAT( \
- PARAM_COUNT, \
- BOOST_MIRROR_BASE_FUNCTION_CALLER_INITIALIZE_FACTORY, \
- param \
- ) { } \
+ typedef typename meta_function::result_type::reflected_type result;\
  \
- template <class Functor> \
- void operator()(Functor func) \
- { \
- func( \
- BOOST_PP_ENUM( \
- PARAM_COUNT, \
- BOOST_MIRROR_BASE_FUNCTION_CALLER_CALL_FACTORY, \
- 0 \
- ) \
- ); \
- } \
- template <class Functor, class Consumer> \
- Consumer& operator()(Functor func, Consumer& consumer) \
- { \
- consumer(func( \
- BOOST_PP_ENUM( \
- PARAM_COUNT, \
- BOOST_MIRROR_BASE_FUNCTION_CALLER_CALL_FACTORY, \
- 0 \
- ) \
- )); \
- return consumer; \
- } \
+ template <class Param> \
+ inline base_functor_caller(Param param) \
+ : _meta_functions() \
+ BOOST_PP_REPEAT( \
+ PARAM_COUNT, \
+ BOOST_MIRROR_BASE_FUNCTION_CALLER_INITIALIZE_FACTORY, \
+ param \
+ ) { } \
+ \
+ template <class Functor> \
+ inline result call(Functor func) \
+ { \
+ return func( \
+ BOOST_PP_ENUM( \
+ PARAM_COUNT, \
+ BOOST_MIRROR_BASE_FUNCTION_CALLER_CALL_FACTORY, \
+ 0 \
+ ) \
+ ); \
+ } \
 };
 
 #define BOOST_MIRROR_DO_IMPLEMENT_BASE_FUNCTION_CALLER(Z, PARAM_COUNT, X) \
- BOOST_MIRROR_IMPLEMENT_BASE_FUNCTION_CALLER(PARAM_COUNT)
+ BOOST_MIRROR_IMPLEMENT_BASE_FUNCTION_CALLER(PARAM_COUNT)
 
 BOOST_PP_REPEAT(
         BOOST_MIRROR_MAX_FUNC_PARAMS(),
@@ -101,28 +112,39 @@
 
 template <
         template <class> class Manufacturer,
- class ParamTypeList
-> struct functor_caller
- : detail::base_functor_caller<
+ class MetaFunctions,
+ class FunctionIndex
+> struct functor_caller : detail::base_functor_caller<
         Manufacturer,
- ParamTypeList,
- mpl::int_<
- mpl::size<ParamTypeList>::value
- >
+ MetaFunctions,
+ FunctionIndex,
+ typename MetaFunctions::
+ template function<FunctionIndex>::params::size
>
 {
- typedef detail::base_functor_caller<
- Manufacturer,
- ParamTypeList,
- mpl::int_<
- mpl::size<ParamTypeList>::value
- >
+private:
+ typedef detail::base_functor_caller<
+ Manufacturer,
+ MetaFunctions,
+ FunctionIndex,
+ typename MetaFunctions::
+ template function<FunctionIndex>::params::size
> base_class;
 
+ typedef typename base_class::result result;
+ typedef typename base_class::meta_function meta_function;
+
+public:
         template <class Param>
         functor_caller(Param param)
          : base_class(param)
         { }
+
+ template <class Class>
+ inline result operator()(Class& instance)
+ {
+ return base_class::call(meta_function::wrap(instance));
+ }
 };
 
 } // namespace mirror

Modified: sandbox/mirror/boost/mirror/meta_constructors.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_constructors.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_constructors.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -215,7 +215,9 @@
 
         template <class FunctionIndex>
         struct function : constructor<FunctionIndex>
- { };
+ {
+ typedef mpl::true_ is_constructor;
+ };
 };
 
 } // namespace mirror

Modified: sandbox/mirror/boost/mirror/meta_mem_functions.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_mem_functions.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_mem_functions.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -52,9 +52,27 @@
         CONST_KW \
 ) \
         param_type_lists_ ## FUNC_INDEX ; \
- static RET_VAL get_result_of(mpl::int_< FUNC_INDEX >); \
- static inline RET_VAL (_detail_class::*)(void) CONST_KW \
- get_address_of(mpl::int_< FUNC_INDEX >) {return &_detail_class::FUNC_NAME;}\
+ static RET_VAL get_result_of( mpl::int_< FUNC_INDEX >); \
+ struct BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ { \
+ private: \
+ CONST_KW _detail_class& instance; \
+ public: \
+ inline BOOST_PP_CAT(wrapper_, FUNC_INDEX)( \
+ CONST_KW _detail_class& inst \
+ ): instance(inst) \
+ { } \
+ \
+ inline RET_VAL operator()(void) const \
+ { \
+ return instance.FUNC_NAME(); \
+ } \
+ }; \
+ static BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ get_wrapper_of( mpl::int_< FUNC_INDEX >); \
+ static inline BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ wrap( mpl::int_< FUNC_INDEX >, CONST_KW _detail_class& inst) \
+ {return BOOST_PP_CAT(wrapper_, FUNC_INDEX)(inst);} \
         BOOST_MIRROR_REG_META_FUNCTION_DEFINE_EMPTY_PARAM_TYPELIST(FUNC_INDEX)\
         BOOST_MIRROR_REG_META_FUNCTION_PUSH_BACK_PARAM_TYPES(\
                 FUNC_INDEX, \
@@ -105,13 +123,31 @@
         TYPENAME_KW\
 ) \
         param_type_lists_ ## FUNC_INDEX ; \
- static RET_VAL get_result_of(mpl::int_< FUNC_INDEX >); \
- typedef RET_VAL (_detail_class::* BOOST_PP_CAT(pointer_to_, FUNC_INDEX))(\
- BOOST_MIRROR_REG_META_FUNCTION_ENUM_PARAM_TYPES(PARAM_SEQ) \
- ) CONST_KW; \
- static inline BOOST_PP_CAT(pointer_to_, FUNC_INDEX) \
- get_address_of(mpl::int_< FUNC_INDEX >) \
- {return &_detail_class::FUNC_NAME;}\
+ static RET_VAL get_result_of( mpl::int_< FUNC_INDEX >); \
+ struct BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ { \
+ private: \
+ CONST_KW _detail_class& instance; \
+ public: \
+ inline BOOST_PP_CAT(wrapper_, FUNC_INDEX)( \
+ CONST_KW _detail_class& inst \
+ ): instance(inst) \
+ { } \
+ \
+ inline RET_VAL operator()(\
+ BOOST_MIRROR_REG_META_FUNCTION_ENUM_PARAM_TYPES_AND_NAMES(PARAM_SEQ) \
+ ) const \
+ { \
+ return instance.FUNC_NAME( \
+ BOOST_MIRROR_REG_META_FUNCTION_ENUM_PARAM_NAMES(PARAM_SEQ) \
+ ); \
+ } \
+ }; \
+ static BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ get_wrapper_of( mpl::int_< FUNC_INDEX >); \
+ static inline BOOST_PP_CAT(wrapper_, FUNC_INDEX) \
+ wrap( mpl::int_< FUNC_INDEX >, CONST_KW _detail_class& inst) \
+ {return BOOST_PP_CAT(wrapper_, FUNC_INDEX)(inst);} \
         BOOST_MIRROR_REG_META_FUNCTION_DEFINE_PARAM_TYPELIST( \
                 FUNC_INDEX, \
                 PARAM_SEQ \
@@ -263,11 +299,11 @@
                 };
 
                 BOOST_TYPEOF_NESTED_TYPEDEF_TPL(
- nested_pointer,
- base_meta_data::get_address_of(FunctionIndex())
+ nested_wrapper,
+ base_meta_data::get_wrapper_of(FunctionIndex())
                 );
 
- typedef typename nested_pointer::type pointer;
+ typedef typename nested_wrapper::type wrapper;
                 
         public:
                 // meta-class reflecting the result type of this function
@@ -277,9 +313,11 @@
                         reflected_type<void>
>::type result_type;
 
- static inline pointer address(void)
+ typedef mpl::false_ is_constructor;
+
+ static inline wrapper wrap(Class& instance)
                 {
- return base_meta_data::get_address_of(FunctionIndex());
+ return base_meta_data::wrap(FunctionIndex(), instance);
                 }
         };
 };

Modified: sandbox/mirror/libs/mirror/example/factories/input_ui.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/input_ui.hpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/input_ui.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -88,22 +88,28 @@
                 ParamIndex pi
         )
         {
+ typedef typename MetaFunctions::
+ template function<FuncIndex> meta_function;
+ //
                         ::boost::cts::bcout() <<
                         ::boost::cts::bstring(tabs, BOOST_CTS_LIT('\t')) <<
                         BOOST_CTS_LIT("Enter ") <<
                         BOOST_MIRRORED_TYPE(Product)::full_name() <<
                         BOOST_CTS_LIT(" ") <<
- MetaFunctions::
- template function<FuncIndex>::params::
+ meta_function::params::
                         template param<ParamIndex>::base_name() <<
                         BOOST_CTS_LIT(" for ") <<
- MetaFunctions::
- template function<FuncIndex>::result_type::
- full_name() <<
- BOOST_CTS_LIT("(");
+ meta_function::result_type::full_name() << (
+ meta_function::is_constructor::value ?
+ ::boost::cts::bstring() :
+ ::boost::cts::bstring(BOOST_CTS_LIT(" "))
+ ) << (
+ meta_function::is_constructor::value ?
+ ::boost::cts::bstring() :
+ meta_function::base_name()
+ ) << BOOST_CTS_LIT("(");
                         //
- MetaFunctions::
- template function<FuncIndex>::params::
+ meta_function::params::
                         for_each(constr_param_name_printer());
                         //
                         ::boost::cts::bcout() <<
@@ -141,18 +147,10 @@
 {
         int tabs;
 
- input_ui(int _tabs, int factory_index)
+ input_ui(int _tabs)
          : tabs(_tabs)
         { }
 
- input_ui(const ::boost::cts::bchar* names[], int factory_index)
- : tabs(0)
- {
- ::boost::cts::bcout() <<
- BOOST_CTS_LIT("Create ") <<
- names[factory_index] << ::std::endl;
- }
-
         template <class Product, class FunctionIndex>
         inline int param(Product* pp, FunctionIndex fi) const
         {

Modified: sandbox/mirror/libs/mirror/example/factories/inserter.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/inserter.cpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/inserter.cpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -68,27 +68,6 @@
 };
 
 
-/** A functor with one parameter. This functor is called
- * by the mirror::function_caller, which also constructs
- * and supplies all the necessary arguments (the single
- * one in this case).
- */
-template <class Class>
-struct back_inserter
-{
- ::std::list< Class >& container;
-
- back_inserter(::std::list< Class >& _container)
- : container(_container)
- { }
-
- void operator()(const Class& inst)
- {
- container.push_back(inst);
- }
-};
-
-
 int main(void)
 {
         using namespace ::boost;
@@ -98,23 +77,30 @@
         // a list of persons
         ::std::list< person > persons;
         //
- // keep inserting while insert_more == 'y'
+ typedef meta_member_functions<person> mem_fns;
+ //
         const cts::bchar yes = BOOST_CTS_LIT('y');
         const cts::bchar no = BOOST_CTS_LIT('n');
         cts::bchar insert_more = yes;
+ cts::bchar change_address = no;
+ // keep inserting while insert_more == 'y'
         while(insert_more == yes)
         {
- // the name of the function argument.
- // there is only one in this case
- const cts::bchar* param_names[] = {BOOST_CTS_LIT("Person")};
- // create a functor caller, plug the input ui in
- // and supply the parameter types and parameter names
- functor_caller<
- input_ui,
- mpl::vector1< person>
- > caller(param_names);
- // call the back inserter by the means of the caller
- caller(back_inserter<person>(persons));
+ factory<input_ui, person> fact;
+ persons.push_back(fact());
+ // check whether to insert more persons
+ do
+ {
+ cts::bcout() <<
+ BOOST_CTS_LIT("Change persons address ? (y/n) ") <<
+ ::std::flush;
+ cts::bcin() >> change_address;
+ } while(change_address != yes && change_address != no);
+ if(change_address == yes)
+ {
+ functor_caller<input_ui, mem_fns, mpl::int_<0> > func(0);
+ func(persons.back());
+ }
                 // check whether to insert more persons
                 do
                 {
@@ -125,32 +111,6 @@
                 } while(insert_more != yes && insert_more != no);
         }
         //
- // TODO: remove this
- //
- typedef meta_member_functions<person> mem_fns;
- typedef mem_fns::function<mpl::int_<0> > fn_0;
- cts::bcout() <<
- fn_0::result_type::base_name() << " " <<
- fn_0::base_name() << "(" <<
- fn_0::params::param<mpl::int_<0> >::type::base_name() << ", " <<
- fn_0::params::param<mpl::int_<1> >::type::base_name() << ", " <<
- fn_0::params::param<mpl::int_<2> >::type::base_name() << ", " <<
- fn_0::params::param<mpl::int_<3> >::type::base_name() << ")" <<
- ::std::endl;
- //
- if(!persons.empty())
- {
- (persons.front().*fn_0::address())(
- BOOST_CTS_LIT("a"),
- BOOST_CTS_LIT("b"),
- BOOST_CTS_LIT("c"),
- BOOST_CTS_LIT("d")
- );
- }
- //
- // TODO:
- //
- //
         // print out all the persons in the list
         cts::bcout() << "Persons:" << ::std::endl;
         ::std::for_each(

Modified: sandbox/mirror/libs/mirror/example/factories/person.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/person.hpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/person.hpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -53,6 +53,14 @@
                 city.assign(_city);
                 postal_code.assign(_postal_code);
         }
+
+ inline ::boost::cts::bstring name_and_surname(void) const
+ {
+ ::boost::cts::bstring result(first_name);
+ result.append(BOOST_CTS_LIT(" "));
+ result.append(family_name);
+ return result;
+ }
 };
 
 } // namespace test
@@ -87,6 +95,9 @@
         ((const ::boost::cts::bstring&)(city))
         ((const ::boost::cts::bstring&)(postal_code))
 )
+BOOST_MIRROR_REG_CONST_MEM_FUNCTION(
+ 1, ::boost::cts::bstring, name_and_surname, ((void))
+)
 BOOST_MIRROR_REG_MEM_FUNCTIONS_END
 
 } // namespace mirror

Modified: sandbox/mirror/libs/mirror/example/factories/tetrahedron.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/tetrahedron.cpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/tetrahedron.cpp 2009-05-08 06:16:57 EDT (Fri, 08 May 2009)
@@ -26,8 +26,7 @@
         using namespace ::boost::mirror;
         //
         // create a factory plugged with the input ui
- const cts::bchar* param_names[] = {BOOST_CTS_LIT("a tetrahedron")};
- factory< ::test::input_ui, ::test::tetrahedron > f(param_names, 0);
+ factory< ::test::input_ui, ::test::tetrahedron > f;
         // use the factory to construct a tetrahedron and calculate
         // it's volume and base area
         ::test::tetrahedron t(f());


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk