|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66642 - in sandbox/SOC/2010/phoenix3: boost/phoenix boost/phoenix/core boost/phoenix/object boost/phoenix/object/detail boost/phoenix/operator boost/phoenix/operator/detail libs/phoenix/test libs/phoenix/test/object
From: thom.heller_at_[hidden]
Date: 2010-11-19 06:23:44
Author: theller
Date: 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
New Revision: 66642
URL: http://svn.boost.org/trac/boost/changeset/66642
Log:
finished refactoring of object module
Added:
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/target.hpp
- copied, changed from r66641, /sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp
Removed:
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp
Text files modified:
sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp | 173 +++++++++++++++++++++++++++++++++++++++
sandbox/SOC/2010/phoenix3/boost/phoenix/core/unpack.hpp | 85 ++++++++++++++++---
sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp | 4
sandbox/SOC/2010/phoenix3/boost/phoenix/object/const_cast.hpp | 38 ++------
sandbox/SOC/2010/phoenix3/boost/phoenix/object/construct.hpp | 74 +++-------------
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct.hpp | 6
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct_eval.hpp | 4
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new.hpp | 8
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new_eval.hpp | 4
sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/target.hpp | 2
sandbox/SOC/2010/phoenix3/boost/phoenix/object/dynamic_cast.hpp | 38 ++------
sandbox/SOC/2010/phoenix3/boost/phoenix/object/new.hpp | 75 ++++-------------
sandbox/SOC/2010/phoenix3/boost/phoenix/object/reinterpret_cast.hpp | 38 ++------
sandbox/SOC/2010/phoenix3/boost/phoenix/object/static_cast.hpp | 38 ++------
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp | 2
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp | 5 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile | 4
sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp | 26 ++++-
18 files changed, 357 insertions(+), 267 deletions(-)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -13,6 +13,7 @@
#define PHOENIX_CORE_EXPRESSION_HPP
#include <boost/phoenix/support/iterate.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
namespace boost { namespace phoenix
{
@@ -39,6 +40,173 @@
}}
+#define PHOENIX_DEFINE_EXPRESSION(NAME, SEQ) \
+ namespace tag { \
+ struct NAME {}; \
+ } \
+ \
+ namespace expression \
+ { \
+ template <BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(SEQ), typename A)> \
+ struct NAME \
+ : expr<tag:: NAME, BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(SEQ), A)> \
+ {}; \
+ } \
+ \
+ namespace rule { \
+ struct NAME \
+ : expression:: NAME <BOOST_PP_SEQ_ENUM(SEQ)> \
+ {}; \
+ } \
+ \
+ template <typename Dummy> \
+ struct meta_grammar::case_<tag:: NAME, Dummy> \
+ : proto::when<rule:: NAME, proto::external_transform> \
+ {}; \
+ /**/
+
+#define PHOENIX_DEFINE_EXPRESSION_VARARG_R(_, N, NAME) \
+ template < \
+ PHOENIX_typename_A( \
+ BOOST_PP_ADD( \
+ N \
+ , BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(2, 1, NAME)) \
+ ) \
+ ) \
+ > \
+ struct BOOST_PP_TUPLE_ELEM(2, 0, NAME)< \
+ PHOENIX_A( \
+ BOOST_PP_ADD(N, BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(2, 1, NAME))) \
+ ) \
+ > \
+ : expr< \
+ tag:: BOOST_PP_TUPLE_ELEM(2, 0, NAME) \
+ , PHOENIX_A( \
+ BOOST_PP_ADD( \
+ N \
+ , BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(2, 1, NAME)) \
+ ) \
+ ) \
+ > \
+ {}; \
+ /**/
+
+#define PHOENIX_DEFINE_EXPRESSION_VARARG(NAME, GRAMMAR, LIMIT) \
+ namespace tag { \
+ struct NAME {}; \
+ } \
+ \
+ namespace expression \
+ { \
+ template < \
+ PHOENIX_typename_A_void( \
+ BOOST_PP_ADD(LIMIT, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(GRAMMAR))) \
+ ) \
+ , typename Dummy = void \
+ > \
+ struct NAME; \
+ \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 1 \
+ , BOOST_PP_ADD(LIMIT, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(GRAMMAR))) \
+ , PHOENIX_DEFINE_EXPRESSION_VARARG_R \
+ , (NAME, BOOST_PP_SEQ_POP_BACK(GRAMMAR)) \
+ ) \
+ } \
+ \
+ namespace rule { \
+ struct NAME \
+ : expression:: NAME < \
+ BOOST_PP_IF( \
+ BOOST_PP_EQUAL(1, BOOST_PP_SEQ_SIZE(GRAMMAR)) \
+ , BOOST_PP_EMPTY() \
+ , BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_POP_BACK(GRAMMAR)) \
+ ) \
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(GRAMMAR))) \
+ proto::vararg< \
+ BOOST_PP_SEQ_ELEM( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(GRAMMAR)) \
+ , GRAMMAR \
+ ) \
+ > \
+ > \
+ {}; \
+ } \
+ \
+ template <typename Dummy> \
+ struct meta_grammar::case_<tag:: NAME, Dummy> \
+ : proto::when<rule:: NAME, proto::external_transform> \
+ {}; \
+ /**/
+
+#define PHOENIX_DEFINE_EXPRESSION_EXT(ACTOR, NAME, SEQ) \
+ namespace tag { \
+ struct NAME {}; \
+ } \
+ \
+ namespace expression \
+ { \
+ template <BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(SEQ), typename A)> \
+ struct NAME \
+ : expr_ext< \
+ ACTOR \
+ , tag:: NAME, BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(SEQ), A)> \
+ {}; \
+ } \
+ \
+ namespace rule { \
+ struct NAME \
+ : expression:: NAME <BOOST_PP_SEQ_ENUM(SEQ)> \
+ {}; \
+ } \
+ \
+ template <typename Dummy> \
+ struct meta_grammar::case_<tag:: NAME, Dummy> \
+ : proto::when<rule:: NAME, proto::external_transform> \
+ {}; \
+ /**/
+
+#if 0
+//TODO: adapt
+#define PHOENIX_DEFINE_EXPRESSION_EXT_VARARG_R(_, N, NAME) \
+ template <PHOENIX_typename_A(N)> \
+ struct BOOST_PP_TUPLE_ELEM(2, 1, NAME) <PHOENIX_A(N)> \
+ : expr_ext< \
+ BOOST_PP_TUPLE_ELEM(2, 0, NAME) \
+ , tag:: BOOST_PP_TUPLE_ELEM(2, 1, NAME) \
+ , PHOENIX_A(N)> \
+ {}; \
+ /**/
+
+#define PHOENIX_DEFINE_EXPRESSION_EXT_VARARG(ACTOR, NAME, GRAMMAR, LIMIT) \
+ namespace tag { \
+ struct NAME {}; \
+ } \
+ \
+ namespace expression \
+ { \
+ template <PHOENIX_typename_A_void(LIMIT), typename Dummy = void> \
+ struct NAME; \
+ \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 1 \
+ , LIMIT \
+ , PHOENIX_DEFINE_EXPRESSION_VARARG_R, (ACTOR, NAME)) \
+ } \
+ \
+ namespace rule { \
+ struct NAME \
+ : expression:: NAME <proto::vararg<GRAMMAR> > \
+ {}; \
+ } \
+ \
+ template <typename Dummy> \
+ struct meta_grammar::case_<tag:: NAME, Dummy> \
+ : proto::when<rule:: NAME, proto::external_transform> \
+ {}; \
+ /**/
+#endif
+
#endif
#else
@@ -47,12 +215,13 @@
: proto::transform<expr_ext<Actor, Tag, PHOENIX_A>, int>
{
typedef typename proto::result_of::make_expr<Tag, default_domain_with_basic_expr, PHOENIX_A>::type base_type;
- typedef Actor<base_type> type;
+ typedef Actor<base_type const> type;
typedef typename proto::nary_expr<Tag, PHOENIX_A>::proto_grammar proto_grammar;
static type const make(PHOENIX_A_a)
{
- type const e = {PHOENIX_a};
+ base_type const b = proto::make_expr<Tag, default_domain_with_basic_expr>(PHOENIX_a);
+ type const e = {b};
return e;
}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/unpack.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/unpack.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/unpack.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -14,6 +14,7 @@
#include <boost/fusion/include/size.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/proto/proto.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
#define M3(_, N, MAX) \
BOOST_PP_COMMA_IF(BOOST_PP_SUB(MAX, N)) \
@@ -77,7 +78,69 @@
typename proto::detail::uncvref<typename proto::when<proto::_, Seq>::template impl<Expr, State, Data>::result_type>::type
>::value>
struct unpack_impl;
-
+
+ template <typename Expr, typename State, typename Data, typename Seq, typename Fun, typename R>
+ struct unpack_impl<Expr, State, Data, Seq, Fun, R(), 0>
+ : proto::transform_impl<Expr, State, Data>
+ {
+ struct fun_type : proto::when<proto::_, Fun> {};
+
+ typedef proto::call<R()> which;
+
+ typedef typename which::template impl<Expr, State, Data>::result_type result_type;
+
+ result_type
+ operator()(
+ typename unpack_impl::expr_param e
+ , typename unpack_impl::state_param s
+ , typename unpack_impl::data_param d
+ ) const
+ {
+ return typename which::template impl<Expr, State, Data>()(e, s, d);
+ }
+ };
+
+ template <typename Expr, typename State, typename Data, typename Seq, typename Fun, typename R>
+ struct unpack_impl<Expr, State, Data, Seq, Fun, R(unpack), 0>
+ : proto::transform_impl<Expr, State, Data>
+ {
+ struct fun_type : proto::when<proto::_, Fun> {};
+
+ typedef proto::call<R()> which;
+
+ typedef typename which::template impl<Expr, State, Data>::result_type result_type;
+
+ result_type
+ operator()(
+ typename unpack_impl::expr_param e
+ , typename unpack_impl::state_param s
+ , typename unpack_impl::data_param d
+ ) const
+ {
+ return typename which::template impl<Expr, State, Data>()(e, s, d);
+ }
+ };
+
+ template <typename Expr, typename State, typename Data, typename Seq, typename Fun, typename R, typename A0>
+ struct unpack_impl<Expr, State, Data, Seq, Fun, R(A0, unpack), 0>
+ : proto::transform_impl<Expr, State, Data>
+ {
+ struct fun_type : proto::when<proto::_, Fun> {};
+
+ typedef proto::call<R(A0)> which;
+
+ typedef typename which::template impl<Expr, State, Data>::result_type result_type;
+
+ result_type
+ operator()(
+ typename unpack_impl::expr_param e
+ , typename unpack_impl::state_param s
+ , typename unpack_impl::data_param d
+ ) const
+ {
+ return typename which::template impl<Expr, State, Data>()(e, s, d);
+ }
+ };
#define M5(_, N, __) fun_type(fusion_at_c< N >(Seq))
@@ -88,12 +151,7 @@
{ \
struct fun_type : proto::when<proto::_, Fun> {}; \
\
- typedef \
- typename mpl::if_c< \
- proto::is_callable<R>::value \
- , proto::call<R(M2(BOOST_PP_ENUM(EXPR_N, M5, EXPR_N), N, ARITY))> \
- , proto::make<R(M2(BOOST_PP_ENUM(EXPR_N, M5, EXPR_N), N, ARITY))> \
- >::type \
+ typedef proto::call<R(M2(BOOST_PP_ENUM(EXPR_N, M5, EXPR_N), N, ARITY))> \
which; \
\
typedef typename which::template impl<Expr, State, Data>::result_type result_type; \
@@ -111,14 +169,13 @@
}; \
/**/
-
-
-#define PHOENIX_ITERATION_PARAMS \
- (3, (1, BOOST_PROTO_MAX_ARITY, \
- <boost/phoenix/core/unpack.hpp>))
+ #define PHOENIX_ITERATION_PARAMS \
+ (3, (1, BOOST_PROTO_MAX_ARITY, \
+ <boost/phoenix/core/unpack.hpp>))
#include PHOENIX_ITERATE()
#undef M1
+
}
}}
@@ -159,7 +216,7 @@
template <typename Expr, typename State, typename Data> \
struct impl \
: phoenix::detail::unpack_impl< \
- Expr, State, Data, Seq, proto::_, R()> \
+ Expr, State, Data, typename boost::remove_pointer<Seq>::type, proto::_, R(M2(phoenix::unpack, N, ARITY))> \
{ \
}; \
}; \
@@ -171,7 +228,7 @@
{ \
template <typename Expr, typename State, typename Data> \
struct impl \
- : phoenix::detail::unpack_impl<Expr, State, Data, Seq, Fun, R(M2(phoenix::unpack, N, ARITY))> \
+ : phoenix::detail::unpack_impl<Expr, State, Data, typename boost::remove_pointer<Seq>::type, Fun, R(M2(phoenix::unpack, N, ARITY))> \
{}; \
}; \
/**/
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -9,10 +9,10 @@
#define PHOENIX_OBJECT_HPP
#include <boost/phoenix/object/const_cast.hpp>
-//#include <boost/phoenix/object/construct.hpp>
+#include <boost/phoenix/object/construct.hpp>
#include <boost/phoenix/object/delete.hpp>
#include <boost/phoenix/object/dynamic_cast.hpp>
-//#include <boost/phoenix/object/new.hpp>
+#include <boost/phoenix/object/new.hpp>
#include <boost/phoenix/object/reinterpret_cast.hpp>
#include <boost/phoenix/object/static_cast.hpp>
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/const_cast.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/const_cast.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/const_cast.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -9,34 +9,16 @@
#define PHOENIX_OBJECT_CONST_CAST_HPP
#include <boost/phoenix/core/expression.hpp>
-#include <boost/phoenix/object/detail/cast_target.hpp>
+#include <boost/phoenix/object/detail/target.hpp>
namespace boost { namespace phoenix
{
- namespace tag {
- struct const_cast_ {};
- }
+ PHOENIX_DEFINE_EXPRESSION(
+ const_cast_
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ )
- namespace expression
- {
- template <typename T, typename U>
- struct const_cast_
- : expr<tag::const_cast_, T, U>
- {};
- }
-
- namespace rule
- {
- struct const_cast_
- : expression::const_cast_<proto::terminal<detail::cast_target<proto::_> >, meta_grammar>
- {};
- }
-
- template <typename Dummy>
- struct meta_grammar::case_<tag::const_cast_, Dummy>
- : proto::when<rule::const_cast_, proto::external_transform>
- {};
-
template <typename T>
struct const_cast_eval
: proto::callable
@@ -57,17 +39,17 @@
{};
template <typename T, typename U>
- typename expression::const_cast_<detail::cast_target<T>, U>::type const
+ typename expression::const_cast_<detail::target<T>, U>::type const
const_cast_(U const& u)
{
- return expression::const_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::const_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
template <typename T, typename U>
- typename expression::const_cast_<detail::cast_target<T>, U>::type const
+ typename expression::const_cast_<detail::target<T>, U>::type const
const_cast_(U & u)
{
- return expression::const_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::const_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
}}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/construct.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/construct.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/construct.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -8,51 +8,30 @@
#ifndef PHOENIX_OBJECT_CONSTRUCT_HPP
#define PHOENIX_OBJECT_CONSTRUCT_HPP
+#include <boost/phoenix/core/expression.hpp>
+#include <boost/phoenix/core/unpack.hpp>
#include <boost/phoenix/support/iterate.hpp>
-#include <boost/phoenix/core/compose.hpp>
+#include <boost/proto/fusion.hpp>
namespace boost { namespace phoenix
{
- namespace result_of
- {
- template <typename Env, typename T, PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)>
- struct construct
- {
- typedef T type;
- };
- }
+ PHOENIX_DEFINE_EXPRESSION_VARARG(
+ construct
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ , PHOENIX_COMPOSITE_LIMIT
+ )
template <typename T>
struct construct_eval
{
- typedef T result_type;
+ typedef typename T::type result_type;
template <typename Env>
result_type
operator()(Env& env) const
{
- return T();
- }
-
- template <typename Env, typename A0>
- result_type
- operator()(Env& env, A0 const& a0) const
- {
- return T(eval(a0, env));
- }
-
- template <typename Env, typename A0, typename A1>
- result_type
- operator()(Env& env, A0 const& a0, A1 const& a1) const
- {
- return T(eval(a0, env), eval(a1, env));
- }
-
- template <typename Env, typename A0, typename A1, typename A2>
- result_type
- operator()(Env& env, A0 const& a0, A1 const& a1, A2 const& a2) const
- {
- return T(eval(a0, env), eval(a1, env), eval(a2, env));
+ return result_type();
}
// Bring in the rest
@@ -60,39 +39,18 @@
};
- template <typename T, PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)>
- struct make_construct
- : compose<construct_eval<T>, PHOENIX_A(PHOENIX_COMPOSITE_LIMIT)>
+ template <typename Dummy>
+ struct default_actions::when<rule::construct, Dummy>
+ : proto::lazy<construct_eval<proto::_value(proto::_child_c<0>)>(_env, unpack(proto::functional::pop_front(proto::_)))>
{};
template <typename T>
- typename make_construct<T>::type const
+ typename expression::construct<detail::target<T> >::type const
construct()
{
- make_construct<T>()();
- }
-
- template <typename T, typename A0>
- typename make_construct<T, A0>::type const
- construct(A0 const& a0)
- {
- return make_construct<T, A0>()(a0);
+ return expression::construct<detail::target<T> >::make(detail::target<T>());
}
- template <typename T, typename A0, typename A1>
- typename make_construct<T, A0, A1>::type const
- construct(A0 const& a0, A1 const& a1)
- {
- return make_construct<T, A0, A1>()(a0, a1);
- }
-
- template <typename T, typename A0, typename A1, typename A2>
- typename make_construct<T, A0, A1, A2>::type const
- construct(A0 const& a0, A1 const& a1, A2 const& a2)
- {
- return make_construct<T, A0, A1, A2>()(a0, a1, a2);
- }
-
// Bring in the rest
#include <boost/phoenix/object/detail/construct.hpp>
Deleted: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
+++ (empty file)
@@ -1,23 +0,0 @@
-/*==============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
- Copyright (c) 2010 Thomas Heller
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-==============================================================================*/
-#ifndef PHOENIX_OBJECT_DETAIL_CAST_TARGET_HPP
-#define PHOENIX_OBJECT_DETAIL_CAST_TARGET_HPP
-
-namespace boost { namespace phoenix
-{
- namespace detail
- {
- template <typename T>
- struct cast_target
- {
- typedef T type;
- };
- }
-}}
-
-#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -12,7 +12,7 @@
#define PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
#define PHOENIX_ITERATION_PARAMS \
- (3, (4, PHOENIX_COMPOSITE_LIMIT, \
+ (3, (1, PHOENIX_COMPOSITE_LIMIT, \
<boost/phoenix/object/detail/construct.hpp>))
#include PHOENIX_ITERATE()
@@ -21,10 +21,10 @@
#else
template <typename T, PHOENIX_typename_A>
- typename make_construct<T, PHOENIX_A>::type const
+ typename expression::construct<detail::target<T>, PHOENIX_A>::type const
construct(PHOENIX_A_const_ref_a)
{
- return make_construct<T, PHOENIX_A>()(PHOENIX_a);
+ return expression::construct<detail::target<T>, PHOENIX_A>::make(detail::target<T>(), PHOENIX_a);
}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct_eval.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct_eval.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/construct_eval.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -12,7 +12,7 @@
#define PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
#define PHOENIX_ITERATION_PARAMS \
- (3, (4, PHOENIX_COMPOSITE_LIMIT, \
+ (3, (1, PHOENIX_COMPOSITE_LIMIT, \
<boost/phoenix/object/detail/construct_eval.hpp>))
#include PHOENIX_ITERATE()
@@ -27,7 +27,7 @@
#define EVAL_a(_,n,__) \
BOOST_PP_COMMA_IF(n) eval(a ## n, env)
- return T(BOOST_PP_REPEAT(PHOENIX_ITERATION, EVAL_a, _));
+ return result_type(BOOST_PP_REPEAT(PHOENIX_ITERATION, EVAL_a, _));
#undef EVAL_a
}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -12,8 +12,8 @@
#define PHOENIX_OBJECT_DETAIL_NEW_HPP
#define PHOENIX_ITERATION_PARAMS \
- (3, (4, PHOENIX_COMPOSITE_LIMIT, \
- <boost/phoenix/object/new.hpp>))
+ (3, (1, PHOENIX_COMPOSITE_LIMIT, \
+ <boost/phoenix/object/detail/new.hpp>))
#include PHOENIX_ITERATE()
#endif
@@ -21,10 +21,10 @@
#else
template <typename T, PHOENIX_typename_A>
- typename make_new<T, PHOENIX_A>::type const
+ typename expression::new_<detail::target<T>, PHOENIX_A>::type const
new_(PHOENIX_A_const_ref_a)
{
- return make_new<T, PHOENIX_A>()(PHOENIX_a);
+ return expression::new_<detail::target<T>, PHOENIX_A>::make(detail::target<T>(), PHOENIX_a);
}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new_eval.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new_eval.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/new_eval.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -12,7 +12,7 @@
#define PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
#define PHOENIX_ITERATION_PARAMS \
- (3, (4, PHOENIX_COMPOSITE_LIMIT, \
+ (3, (1, PHOENIX_COMPOSITE_LIMIT, \
<boost/phoenix/object/detail/new_eval.hpp>))
#include PHOENIX_ITERATE()
@@ -27,7 +27,7 @@
#define EVAL_a(_,n,__) \
BOOST_PP_COMMA_IF(n) eval(a ## n, env)
- return new T(BOOST_PP_REPEAT(PHOENIX_ITERATION, EVAL_a, _));
+ return new construct_type(BOOST_PP_REPEAT(PHOENIX_ITERATION, EVAL_a, _));
#undef EVAL_a
}
Copied: sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/target.hpp (from r66641, /sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp)
==============================================================================
--- /sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/cast_target.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/detail/target.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -13,7 +13,7 @@
namespace detail
{
template <typename T>
- struct cast_target
+ struct target
{
typedef T type;
};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/dynamic_cast.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/dynamic_cast.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/dynamic_cast.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -9,33 +9,15 @@
#define PHOENIX_OBJECT_DYNAMIC_CAST_HPP
#include <boost/phoenix/core/expression.hpp>
-#include <boost/phoenix/object/detail/cast_target.hpp>
+#include <boost/phoenix/object/detail/target.hpp>
namespace boost { namespace phoenix
{
- namespace tag {
- struct dynamic_cast_ {};
- }
-
- namespace expression
- {
- template <typename T, typename U>
- struct dynamic_cast_
- : expr<tag::dynamic_cast_, T, U>
- {};
- }
-
- namespace rule
- {
- struct dynamic_cast_
- : expression::dynamic_cast_<proto::terminal<detail::cast_target<proto::_> >, meta_grammar>
- {};
- }
-
- template <typename Dummy>
- struct meta_grammar::case_<tag::dynamic_cast_, Dummy>
- : proto::when<rule::dynamic_cast_, proto::external_transform>
- {};
+ PHOENIX_DEFINE_EXPRESSION(
+ dynamic_cast_
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ )
template <typename T>
struct dynamic_cast_eval
@@ -57,17 +39,17 @@
{};
template <typename T, typename U>
- typename expression::dynamic_cast_<detail::cast_target<T>, U>::type const
+ typename expression::dynamic_cast_<detail::target<T>, U>::type const
dynamic_cast_(U const& u)
{
- return expression::dynamic_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::dynamic_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
template <typename T, typename U>
- typename expression::dynamic_cast_<detail::cast_target<T>, U>::type const
+ typename expression::dynamic_cast_<detail::target<T>, U>::type const
dynamic_cast_(U & u)
{
- return expression::dynamic_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::dynamic_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
}}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/new.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/new.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/new.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -8,87 +8,48 @@
#ifndef PHOENIX_OBJECT_NEW_HPP
#define PHOENIX_OBJECT_NEW_HPP
-#include <boost/phoenix/core/compose.hpp>
+#include <boost/phoenix/core/expression.hpp>
+#include <boost/phoenix/core/unpack.hpp>
#include <boost/phoenix/support/iterate.hpp>
+#include <boost/proto/fusion.hpp>
namespace boost { namespace phoenix
{
- namespace result_of
- {
- template <typename Env, typename T, PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)>
- struct new_
- {
- typedef T* type;
- };
- }
+ PHOENIX_DEFINE_EXPRESSION_VARARG(
+ new_
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ , PHOENIX_COMPOSITE_LIMIT
+ )
template <typename T>
struct new_eval
+ : proto::callable
{
- typedef T* result_type;
+ typedef typename T::type construct_type;
+ typedef typename T::type* result_type;
template <typename Env>
result_type
operator()(Env& env) const
{
- return new T;
- }
-
- template <typename Env, typename A0>
- result_type
- operator()(Env& env, A0 const& a0) const
- {
- return new T(eval(a0, env));
- }
-
- template <typename Env, typename A0, typename A1>
- result_type
- operator()(Env& env, A0 const& a0, A1 const& a1) const
- {
- return new T(eval(a0, env), eval(a1, env));
- }
-
- template <typename Env, typename A0, typename A1, typename A2>
- result_type
- operator()(Env& env, A0 const& a0, A1 const& a1, A2 const& a2) const
- {
- return new T(eval(a0, env), eval(a1, env), eval(a2, env));
+ return new construct_type;
}
// Bring in the rest
#include <boost/phoenix/object/detail/new_eval.hpp>
};
- template <typename T, PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)>
- struct make_new : compose<new_eval<T>, PHOENIX_A(PHOENIX_COMPOSITE_LIMIT)>
+ template <typename Dummy>
+ struct default_actions::when<rule::new_, Dummy>
+ : proto::lazy<new_eval<proto::_value(proto::_child_c<0>)>(_env, unpack(proto::functional::pop_front(proto::_)))>
{};
template <typename T>
- typename make_new<T>::type const
+ typename expression::new_<detail::target<T> >::type const
new_()
{
- return make_new<T>()();
- }
-
- template <typename T, typename A0>
- typename make_new<T, A0>::type const
- new_(A0 const& a0)
- {
- return make_new<T, A0>()(a0);
- }
-
- template <typename T, typename A0, typename A1>
- typename make_new<T, A0, A1>::type const
- new_(A0 const& a0, A1 const& a1)
- {
- return make_new<T, A0, A1>()(a0, a1);
- }
-
- template <typename T, typename A0, typename A1, typename A2>
- typename make_new<T, A0, A1, A2>::type const
- new_(A0 const& a0, A1 const& a1, A2 const& a2)
- {
- return make_new<T, A0, A1, A2>()(a0, a1, a2);
+ return expression::new_<detail::target<T> >::make(detail::target<T>());
}
// Bring in the rest
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/reinterpret_cast.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/reinterpret_cast.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/reinterpret_cast.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -9,33 +9,15 @@
#define PHOENIX_OBJECT_REINTERPRET_CAST_HPP
#include <boost/phoenix/core/expression.hpp>
-#include <boost/phoenix/object/detail/cast_target.hpp>
+#include <boost/phoenix/object/detail/target.hpp>
namespace boost { namespace phoenix
{
- namespace tag {
- struct reinterpret_cast_ {};
- }
-
- namespace expression
- {
- template <typename T, typename U>
- struct reinterpret_cast_
- : expr<tag::reinterpret_cast_, T, U>
- {};
- }
-
- namespace rule
- {
- struct reinterpret_cast_
- : expression::reinterpret_cast_<proto::terminal<detail::cast_target<proto::_> >, meta_grammar>
- {};
- }
-
- template <typename Dummy>
- struct meta_grammar::case_<tag::reinterpret_cast_, Dummy>
- : proto::when<rule::reinterpret_cast_, proto::external_transform>
- {};
+ PHOENIX_DEFINE_EXPRESSION(
+ reinterpret_cast_
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ )
template <typename T>
struct reinterpret_cast_eval
@@ -57,17 +39,17 @@
{};
template <typename T, typename U>
- typename expression::reinterpret_cast_<detail::cast_target<T>, U>::type const
+ typename expression::reinterpret_cast_<detail::target<T>, U>::type const
reinterpret_cast_(U const& u)
{
- return expression::reinterpret_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::reinterpret_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
template <typename T, typename U>
- typename expression::reinterpret_cast_<detail::cast_target<T>, U>::type const
+ typename expression::reinterpret_cast_<detail::target<T>, U>::type const
reinterpret_cast_(U & u)
{
- return expression::reinterpret_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::reinterpret_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
}}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/object/static_cast.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/object/static_cast.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/object/static_cast.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -9,33 +9,15 @@
#define PHOENIX_OBJECT_STATIC_CAST_HPP
#include <boost/phoenix/core/expression.hpp>
-#include <boost/phoenix/object/detail/cast_target.hpp>
+#include <boost/phoenix/object/detail/target.hpp>
namespace boost { namespace phoenix
{
- namespace tag {
- struct static_cast_ {};
- }
-
- namespace expression
- {
- template <typename T, typename U>
- struct static_cast_
- : expr<tag::static_cast_, T, U>
- {};
- }
-
- namespace rule
- {
- struct static_cast_
- : expression::static_cast_<proto::terminal<detail::cast_target<proto::_> >, meta_grammar>
- {};
- }
-
- template <typename Dummy>
- struct meta_grammar::case_<tag::static_cast_, Dummy>
- : proto::when<rule::static_cast_, proto::external_transform>
- {};
+ PHOENIX_DEFINE_EXPRESSION(
+ static_cast_
+ , (proto::terminal<detail::target<proto::_> >)
+ (meta_grammar)
+ )
template <typename T>
struct static_cast_eval
@@ -57,17 +39,17 @@
{};
template <typename T, typename U>
- typename expression::static_cast_<detail::cast_target<T>, U>::type const
+ typename expression::static_cast_<detail::target<T>, U>::type const
static_cast_(U const& u)
{
- return expression::static_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::static_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
template <typename T, typename U>
- typename expression::static_cast_<detail::cast_target<T>, U>::type const
+ typename expression::static_cast_<detail::target<T>, U>::type const
static_cast_(U & u)
{
- return expression::static_cast_<detail::cast_target<T>, U>::make(detail::cast_target<T>(), u);
+ return expression::static_cast_<detail::target<T>, U>::make(detail::target<T>(), u);
}
}}
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -15,7 +15,7 @@
{
namespace tag
{
- struct mem_fun_ptr {};
+ struct mem_fun_ptr;
}
namespace detail {
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -11,6 +11,7 @@
#include <boost/proto/make_expr.hpp>
#include <boost/proto/tags.hpp>
#include <boost/type_traits/is_member_object_pointer.hpp>*/
+#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/unpack.hpp>
#include <boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp>
#include <boost/phoenix/support/iterate.hpp>
@@ -23,6 +24,9 @@
(mem_ptr)
)
+ PHOENIX_DEFINE_EXPRESSION_VARARG(mem_fun_ptr, (meta_grammar), PHOENIX_LIMIT)
+
+ /*
namespace rule
{
struct mem_fun_ptr
@@ -34,6 +38,7 @@
struct meta_grammar::case_<tag::mem_fun_ptr, Dummy>
: proto::when<rule::mem_fun_ptr, proto::external_transform>
{};
+ */
template <typename Object, typename MemPtr>
typename enable_if<
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/Jamfile 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -35,8 +35,8 @@
;
test-suite phoenix_object :
-# [ run object/cast_tests.cpp ]
-# [ run object/new_delete_tests.cpp ]
+ [ run object/cast_tests.cpp ]
+ [ run object/new_delete_tests.cpp ]
;
test-suite phoenix_function :
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/object/new_delete_tests.cpp 2010-11-19 06:23:38 EST (Fri, 19 Nov 2010)
@@ -29,9 +29,9 @@
main()
{
using boost::phoenix::arg_names::arg1;
- //using boost::phoenix::construct;
+ using boost::phoenix::construct;
using boost::phoenix::delete_;
- //using boost::phoenix::new_;
+ using boost::phoenix::new_;
using std::for_each;
using std::vector;
@@ -39,21 +39,33 @@
{
vector<X*> v(10);
- //for_each(v.begin(), v.end(), arg1 = new_<X>());
+ for_each(v.begin(), v.end(), arg1 = new_<X>());
for_each(v.begin(), v.end(), delete_(arg1));
- //for_each(v.begin(), v.end(), arg1 = new_<X>(1, 2, 3));
+ for_each(v.begin(), v.end(), arg1 = new_<X>(1, 2, 3));
for_each(v.begin(), v.end(), delete_(arg1));
}
{
using boost::shared_ptr;
vector<shared_ptr<X> > v(10);
- //for_each(v.begin(), v.end(),
- // arg1 = construct<shared_ptr<X> >(new_<X>())
- //);
+ for_each(v.begin(), v.end(),
+ arg1 = construct<shared_ptr<X> >(new_<X>())
+ );
}
BOOST_TEST(n == 0);
return boost::report_errors();
}
+//PHOENIX_DEFINE_EXPRESSION_VARARG(new_, (proto::terminal<detail::target<proto::_> >)(meta_grammar), PHOENIX_LIMIT)
+
+/*
+#include <boost/preprocessor/comparison/equal.hpp>
+
+
+#define SEQ (h)
+
+BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(SEQ)), SEQ)
+
+BOOST_PP_IF(BOOST_PP_EQUAL(1, BOOST_PP_SEQ_SIZE(SEQ)), BOOST_PP_EMPTY(), BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_POP_BACK(SEQ)))
+*/
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