|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50263 - in sandbox/mirror/boost/mirror: . meta_classes/boost/tuples meta_classes/std
From: chochlik_at_[hidden]
Date: 2008-12-13 15:54:57
Author: matus.chochlik
Date: 2008-12-13 15:54:57 EST (Sat, 13 Dec 2008)
New Revision: 50263
URL: http://svn.boost.org/trac/boost/changeset/50263
Log:
[mirror 0.3.x]
- Added meta-constructors and the customizable factory
- Added generic functor caller
Text files modified:
sandbox/mirror/boost/mirror/meta_classes/boost/tuples/tuple.hpp | 17 +++++++++++++++++
sandbox/mirror/boost/mirror/meta_classes/std/pair.hpp | 5 +++++
sandbox/mirror/boost/mirror/meta_constructors.hpp | 24 ++++++++++++++++++++----
3 files changed, 42 insertions(+), 4 deletions(-)
Modified: sandbox/mirror/boost/mirror/meta_classes/boost/tuples/tuple.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_classes/boost/tuples/tuple.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_classes/boost/tuples/tuple.hpp 2008-12-13 15:54:57 EST (Sat, 13 Dec 2008)
@@ -14,6 +14,7 @@
#include <boost/mirror/meta_types/boost/tuples/tuple.hpp>
#include <boost/mirror/detail/static_int_to_str.hpp>
#include <boost/mirror/detail/unnamed_attribs.hpp>
+#include <boost/mirror/meta_constructors.hpp>
namespace boost {
namespace mirror {
@@ -104,6 +105,22 @@
typedef template_params
BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_END
+BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTORS_BEGIN( ::boost::tuples::tuple, 10)
+ BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(0)
+ BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTOR(1,
+ ((T0)(_0))
+ ((T1)(_1))
+ ((T2)(_2))
+ ((T3)(_3))
+ ((T4)(_4))
+ ((T5)(_5))
+ ((T6)(_6))
+ ((T7)(_7))
+ ((T8)(_8))
+ ((T9)(_9))
+)
+BOOST_MIRROR_REG_CONSTRUCTORS_END
+
} // namespace mirror
} // namespace boost
Modified: sandbox/mirror/boost/mirror/meta_classes/std/pair.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_classes/std/pair.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_classes/std/pair.hpp 2008-12-13 15:54:57 EST (Sat, 13 Dec 2008)
@@ -11,6 +11,7 @@
#define BOOST_MIRROR_META_CLASSES_STD_PAIR_HPP
#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/meta_constructors.hpp>
#include <boost/mirror/meta_types/std/pair.hpp>
namespace boost {
@@ -21,6 +22,10 @@
BOOST_MIRROR_REG_SIMPLE_TEMPLATE_ATTRIB(_, T1, second)
BOOST_MIRROR_REG_TEMPLATE_ATTRIBS_END
+BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTORS_BEGIN( ::std::pair, 2)
+ BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(0)
+ BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTOR(1, ((T0)(first))((T1)(second)))
+BOOST_MIRROR_REG_CONSTRUCTORS_END
} // namespace mirror
} // namespace boost
Modified: sandbox/mirror/boost/mirror/meta_constructors.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_constructors.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_constructors.hpp 2008-12-13 15:54:57 EST (Sat, 13 Dec 2008)
@@ -21,7 +21,8 @@
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
namespace boost {
namespace mirror {
@@ -29,6 +30,16 @@
template <class Class /*, class VariantTag*/ >
struct meta_constructors;
+
+#define BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTORS_BEGIN(TEMPLATE, TEMPL_ARG_COUNT) \
+template < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, typename T) > \
+struct meta_constructors< \
+ TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) > \
+> \
+{ \
+ typedef mpl::vector0<>
+
+
#define BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN(CLASS) \
template <> \
struct meta_constructors< CLASS > \
@@ -92,18 +103,23 @@
BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) \
>::type
-#define BOOST_MIRROR_REG_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ) \
+#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, TYPENAME_KW) \
param_type_lists_ ## CONSTR_INDEX ; \
typedef BOOST_PP_CAT(mpl::vector, BOOST_PP_SEQ_SIZE(PARAM_SEQ)) < \
BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_CONSTR_EXTRACT_PARAM_TYPE, 0, PARAM_SEQ) \
> BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) ;\
BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_CONSTR_REG_CALL_PARAM_NAME, CONSTR_INDEX, PARAM_SEQ) \
- typedef mpl::push_back< \
+ typedef TYPENAME_KW mpl::push_back< \
BOOST_PP_CAT(param_type_lists_, CONSTR_INDEX), \
BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) \
>::type
-
+#define BOOST_MIRROR_REG_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ) \
+ BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, BOOST_PP_EMPTY())
+
+#define BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ) \
+ BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, typename)
+
#define BOOST_MIRROR_REGISTER_NATIVE_TYPE_CONSTRUCTORS(TYPE)\
BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( TYPE ) \
BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(0) \
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