|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63027 - in sandbox/SOC/2010/phoenix3: . boost/phoenix boost/phoenix/bind boost/phoenix/core boost/phoenix/function boost/phoenix/operator boost/phoenix/statement boost/phoenix/support boost/phoenix/support/detail libs/phoenix/test/bind libs/phoenix/test/core libs/phoenix/test/function libs/phoenix/test/operator
From: thom.heller_at_[hidden]
Date: 2010-06-16 17:43:20
Author: theller
Date: 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
New Revision: 63027
URL: http://svn.boost.org/trac/boost/changeset/63027
Log:
+ implemented PP file iterations with predefined macros for typenames etc.
+ added full support for member operator
+ added full support for std::iostream operator
+ implemented perfect forwarding for actor
+ adapted some test cases for "best-practice"
+ implemented variadic arguments for all actors based on phoenix/core/limits.h
+ added proper boost build handling
+ arity calculation tweak from Eric
Added:
sandbox/SOC/2010/phoenix3/Jamfile.v2 (contents, props changed)
sandbox/SOC/2010/phoenix3/Jamroot.jam (contents, props changed)
sandbox/SOC/2010/phoenix3/boost-build.jam (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/io.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/support/detail/
sandbox/SOC/2010/phoenix3/boost/phoenix/support/detail/iterate.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/support/iterate.hpp (contents, props changed)
Text files modified:
sandbox/SOC/2010/phoenix3/boost/phoenix/bind/bind.hpp | 34 ++++---
sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp | 159 +++++++++++++++++++++++++++------------
sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp | 50 ++----------
sandbox/SOC/2010/phoenix3/boost/phoenix/core/compose.hpp | 135 +++++++--------------------------
sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp | 34 +++++---
sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp | 17 +++-
sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp | 2
sandbox/SOC/2010/phoenix3/boost/phoenix/function/function.hpp | 128 ++++++++++++++++++-------------
sandbox/SOC/2010/phoenix3/boost/phoenix/operator.hpp | 2
sandbox/SOC/2010/phoenix3/boost/phoenix/statement/if.hpp | 12 ++-
sandbox/SOC/2010/phoenix3/libs/phoenix/test/bind/bind_function_object_tests.cpp | 30 ++++---
sandbox/SOC/2010/phoenix3/libs/phoenix/test/core/primitives_tests.cpp | 8 +-
sandbox/SOC/2010/phoenix3/libs/phoenix/test/function/function_tests.cpp | 13 +-
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp | 6 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/bitwise_tests.cpp | 9 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/comparison_tests.cpp | 5
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/if_else_tests.cpp | 8 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/io_tests.cpp | 27 ++++--
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/logical_tests.cpp | 12 +-
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp | 33 ++++---
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/misc_binary_tests.cpp | 9 +
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/self_tests.cpp | 28 ++++---
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/unary_tests.cpp | 7 +
23 files changed, 406 insertions(+), 362 deletions(-)
Added: sandbox/SOC/2010/phoenix3/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/Jamfile.v2 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,28 @@
+# Copyright Rene Rivera 2007.
+#
+# 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)
+
+# Usage:
+#
+# bjam [options | properties | targets]
+#
+# Options:
+#
+# --boost=<BOOST> The directotory of a Boost source tree.
+# Default; BOOST env var (if found)
+# Default; ../boost (if found)
+#
+# --boost-build=<BOOST_BUILD>
+# The directory for the Boost.Build v2 files.
+# Default; BOOST_BUILD_PATH env var (if found)
+# Default; BOOST_BUILD env var (if found)
+# Default; <BOOST>/tools/build/v2 (if found)
+
+#~ If we have the Boost sources we can use the project...
+
+if [ GLOB $(BOOST) : [ modules.peek phoenix : JAMFILE ] ]
+{
+ use-project /boost : $(BOOST) ;
+}
Added: sandbox/SOC/2010/phoenix3/Jamroot.jam
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/Jamroot.jam 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,7 @@
+
+import modules ;
+
+local boost = [ modules.peek : BOOST ] ;
+
+project phoenix : requirements <include>$(boost) ;
+
Added: sandbox/SOC/2010/phoenix3/boost-build.jam
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost-build.jam 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,65 @@
+# Copyright Rene Rivera 2007.
+#
+# 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)
+
+# For instructions see Jamfile.v2, or "bjam --help".
+
+local rule if-has-file ( file + : dir * )
+{
+ local result ;
+ if $(dir)
+ {
+ result = [ GLOB $(dir) : $(file) ] ;
+ }
+ return $(result[1]:P) ;
+}
+
+#~ Attempts to find the Boost source tree...
+
+local boost-src = [ if-has-file LICENSE_1_0.txt :
+ [ MATCH --boost=(.*) : $(ARGV) ]
+ $(BOOST)
+ $(.boost-build-file:D)/../boost
+ $(.boost-build-file:D)/../Trunk
+ ] ;
+
+# error handling:
+if ! $(boost-src)
+{
+ ECHO Unable to find the Boost source tree in the locations searched. ;
+ ECHO Try setting the environment variable BOOST to point to your ;
+ ECHO Boost tree, or else invoke bjam with the --boost=path option. ;
+ ECHO The Boost include path will not be automatically set. ;
+}
+
+#~ Attempts to find the Boost.Build files...
+
+local boost-build-src = [ if-has-file bootstrap.jam :
+ [ MATCH --boost-build=(.*) : $(ARGV) ]
+ $(BOOST_BUILD_PATH)
+ $(BOOST_BUILD)
+ $(boost-src)/tools/build/v2
+ ] ;
+
+# error handling:
+if ! $(boost-build-src)
+{
+ ECHO Unable to find the Boost.Build source tree in the locations searched. ;
+ ECHO Try setting the environment variable BOOST_BUILD to point to your ;
+ ECHO Boost.Build tree, or else invoke bjam with the --boost-build=path option. ;
+ ECHO More failures will very likely follow... ;
+}
+
+#~ Set some common vars to refer to the Boost sources...
+
+BOOST ?= $(boost-src) ;
+BOOST_ROOT ?= $(boost-src) ;
+
+#~ And load up Boost.Build...
+
+boost-build $(boost-build-src) ;
+
+
+
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/bind/bind.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/bind/bind.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/bind/bind.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -5,10 +5,14 @@
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)
==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
#ifndef PHOENIX_BIND_BIND_HPP
#define PHOENIX_BIND_BIND_HPP
#include <boost/phoenix/function/function.hpp>
+#include <boost/phoenix/support/iterate.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace phoenix
@@ -24,23 +28,23 @@
{
return function<F>(f)();
}
-
- template<typename F, typename A0>
- typename boost::result_of<function<F>(A0 const &)>::type
- bind(F f, A0 const & a0)
- {
- return function<F>(f)(a0);
- }
-
- template<typename F, typename A0, typename A1>
- typename boost::result_of<function<F>(A0 const &, A1 const &)>::type
- bind(F f, A0 const & a0, A1 const & a1)
- {
- return function<F>(f)(a0, a1);
- }
- /* ... more ... */
+#define PHOENIX_ITERATION_PARAMS \
+ (3, (1, PHOENIX_ARG_LIMIT, \
+ <boost/phoenix/bind/bind.hpp>))
+#include PHOENIX_ITERATE()
}}
#endif
+
+#else
+
+ template<typename F, PHOENIX_typename_A>
+ typename boost::result_of<function<F>(PHOENIX_A_const_ref)>::type
+ bind(F f, PHOENIX_A_const_ref_a)
+ {
+ return function<F>(f)(PHOENIX_a);
+ }
+
+#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -5,15 +5,33 @@
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)
==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
#ifndef PHOENIX_CORE_ACTOR_HPP
#define PHOENIX_CORE_ACTOR_HPP
+#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/phoenix/core/arity.hpp>
#include <boost/phoenix/core/domain.hpp>
#include <boost/phoenix/core/environment.hpp>
+#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/phoenix/support/iterate.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/facilities/expand.hpp>
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/preprocessor/seq/fold_right.hpp>
+#include <boost/preprocessor/seq/for_each_i.hpp>
+#include <boost/preprocessor/seq/for_each_product.hpp>
+#include <boost/preprocessor/tuple/rem.hpp>
#include <boost/proto/extends.hpp>
#include <boost/proto/debug.hpp>
#include <boost/utility/result_of.hpp>
@@ -35,9 +53,9 @@
namespace result_of
{
- template <typename Expr, typename A0 = void, typename A1 = void
- /* ... more ... */,
- typename Dummy = void>
+ template <typename Expr
+ , PHOENIX_typename_A_void(PHOENIX_ACTOR_LIMIT)
+ , typename Dummy = void>
struct actor;
template <typename Expr>
@@ -54,20 +72,15 @@
>::type
type;
};
-
- template <typename Expr, typename A0>
- struct actor<Expr, A0>
- : boost::result_of<eval_grammar(
- ::boost::phoenix::actor<Expr> const&,
- typename make_basic_environment<A0>::type&)>
- {};
-
- template <typename Expr, typename A0, typename A1>
- struct actor<Expr, A0, A1>
- : boost::result_of<eval_grammar(
- ::boost::phoenix::actor<Expr> const&,
- typename make_basic_environment<A0, A1>::type&)>
- {};
+
+#define PHOENIX_ITERATE_RESULT_OF 1
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_ACTOR_LIMIT, \
+ <boost/phoenix/core/actor.hpp>, \
+ PHOENIX_ITERATE_RESULT_OF))
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_RESULT_OF
+
}
////////////////////////////////////////////////////////////////////////////
@@ -94,16 +107,6 @@
: result_of::actor<Expr>
{};
- template <typename This, typename A0>
- struct result<This(A0)>
- : result_of::actor<Expr, A0>
- {};
-
- template <typename This, typename A0, typename A1>
- struct result<This(A0, A1)>
- : result_of::actor<Expr, A0, A1>
- {};
-
typename result_of::actor<Expr>::type
operator()() const
{
@@ -113,39 +116,99 @@
return eval(this->proto_base(), args);
}
- template <typename A0>
- typename result_of::actor<Expr, A0 const &>::type
- operator()(A0 const& a0) const
+#define PHOENIX_ITERATE_OPERATOR 2
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_ACTOR_LIMIT, \
+ <boost/phoenix/core/actor.hpp>, \
+ PHOENIX_ITERATE_OPERATOR))
+
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_OPERATOR
+
+ };
+}
+
+ // specialize boost::result_of to return the proper result type
+ template<typename Expr>
+ struct result_of<phoenix::actor<Expr>() >
+ : phoenix::result_of::actor<Expr>
+ {};
+
+}
+
+#endif
+
+#else
+
+#define PHOENIX_ENV( A ) typename make_basic_environment<A>::type
+
+#if BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_RESULT_OF
+
+ template <typename Expr, PHOENIX_typename_A>
+ struct actor<Expr, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, A)>
+ : boost::result_of<eval_grammar(
+ ::boost::phoenix::actor<Expr> const &,
+ PHOENIX_ENV(BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, A))&)>
+ {};
+
+#elif BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_OPERATOR
+
+ template <typename This, PHOENIX_typename_A>
+ struct result<This(BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, A))>
+ : result_of::actor<Expr, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, A)>
+ {};
+
+#if PHOENIX_ITERATION >= PHOENIX_PERFECT_FORWARD_LIMIT
+
+ template <PHOENIX_typename_A>
+ typename result_of::actor<Expr, PHOENIX_A_ref>::type
+ operator()(PHOENIX_A_ref_a) const
{
BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar);
- typename make_basic_environment<A0 const&>::type args(a0);
+ PHOENIX_ENV(PHOENIX_A_ref) args( PHOENIX_a);
return eval(*this, args);
}
- template <typename A0, typename A1>
- typename result_of::actor<Expr, A0 const &, A1 const &>::type
- operator()(A0 const& a0, A1 const& a1) const
+ template <PHOENIX_typename_A>
+ typename result_of::actor<Expr, PHOENIX_A_const_ref>::type
+ operator()(PHOENIX_A_const_ref_a) const
{
BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar);
- typename make_basic_environment<A0 const&, A1 const&>::type args(a0, a1);
-
- std::cout << typeid( eval( *this, args ) ).name() << "\n";
+ PHOENIX_ENV(PHOENIX_A_const_ref) args( PHOENIX_a);
return eval(*this, args);
}
-
- /*... more...*/
- };
-}
-// $$$ Why is this needed??? $$$
-// template<typename Expr>
-// struct result_of<phoenix::actor<Expr>() >
-// {
-// typedef typename phoenix::actor<Expr>::nullary_result type;
-// };
+#else
-}
+// We need to define operator() for all permutations of reference types.
+// For PHOENIX_ITERATION <= PHOENIX_LIMIT_PREFECT_FORWARD
+// 2^PHOENIX_ITERATION overloads are created
+// For compile time reasons,
+// if PHOENIX_ITERATION > PHOENIX_LIMIT_PERFECT_FORWARD
+// only operator()(A const &...a) and operator()(A &...a) are generated
+// this is all handled by the PP mumbo jumbo above
+#define PHOENIX_ACTOR_OPERATOR(_, I, __) \
+ template <PHOENIX_typename_A> \
+ typename result_of::actor<Expr, PHOENIX_PERM_A(I)>::type \
+ operator()(PHOENIX_PERM_A_a(I)) const \
+ { \
+ BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar); \
+ PHOENIX_ENV(PHOENIX_PERM_A(I)) args(PHOENIX_a); \
+ \
+ return eval(*this, args); \
+ }
+
+ BOOST_PP_REPEAT( PHOENIX_PERM_SIZE, PHOENIX_ACTOR_OPERATOR, _)
+
+#undef PHOENIX_ACTOR_OPERATOR
#endif
+
+#endif
+
+#undef PHOENIX_ENV
+
+#endif
+
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -36,53 +36,23 @@
namespace detail
{
- struct arity : proto::switch_<struct arity_cases>
- {};
-
- typedef proto::fold<
- proto::_,
- mpl::int_<0>(),
- mpl::max<arity, proto::_state>()>
- arity_fold;
-
- typedef proto::when<proto::_, mpl::int_<0>()> arity_default;
-
- struct arity_cases
- {
- template <typename Tag>
- struct case_
- : proto::or_<
- proto::when<
- proto::nary_expr<proto::_, proto::vararg<arity> >
- , arity_fold
- >
- , arity_default
- >
- {};
- };
-
- template <>
- struct arity_cases::case_<proto::tag::function>
+ struct arity
: proto::or_<
- proto::when<
- proto::function<
- proto::terminal<funcwrap<argument> >
- , proto::terminal<env>
- , proto::_ >
- , mpl::next<proto::_value(proto::_child2)>()>
+ proto::when<proto::terminal<proto::_>, mpl::int_<0>()>
, proto::when<
proto::function<
- proto::terminal<funcwrap<proto::_> >
+ proto::terminal<funcwrap<argument> >
, proto::terminal<env>
- , proto::vararg<arity>
+ , proto::_
>
- , arity_fold
+ , mpl::next<proto::_value(proto::_child2)>()
>
- , proto::when<
- proto::function<
- proto::vararg<arity>
+ , proto::otherwise<
+ proto::fold<
+ proto::_
+ , mpl::int_<0>()
+ , mpl::max<arity, proto::_state>()
>
- , arity_fold
>
>
{};
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/compose.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/compose.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/compose.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -5,14 +5,17 @@
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)
==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
#ifndef PHOENIX_CORE_COMPOSE_HPP
#define PHOENIX_CORE_COMPOSE_HPP
#include <boost/call_traits.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
-#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/phoenix/core/limits.hpp>
+#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/phoenix/support/iterate.hpp>
#include <boost/proto/tags.hpp>
#include <boost/proto/make_expr.hpp>
@@ -31,16 +34,14 @@
{};
template <typename F, template< typename > class Actor
- , typename A0 = void, typename A1 = void, typename A2 = void, typename A3 = void
- /* ... more ... */
+ , PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)
, typename Dummy = void>
struct compose_ex;
template <typename F
- , typename A0 = void, typename A1 = void, typename A2 = void, typename A3 = void
- /* ... more ... */
- , typename Dummy = void>
- struct compose : compose_ex<F, actor, A0, A1, A2, A3 /** ... more ... **/> {};
+ , PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)
+ , typename Dummy = void>
+ struct compose : compose_ex<F, actor, PHOENIX_A(PHOENIX_COMPOSITE_LIMIT)> {};
template <typename F, template<typename> class Actor>
struct compose_ex<F, Actor>
@@ -58,62 +59,24 @@
result_type
operator()() const
{
- actor<base_type> const e = {{funcwrap<F>(), env()}};
+ actor<base_type> const e = {{{funcwrap<F>()}, {env()}}};
return e;
}
};
- template <typename F, template<typename> class Actor, typename A0>
- struct compose_ex<F, Actor, A0>
- {
- typedef
- typename proto::result_of::make_expr<
- proto::tag::function
- , default_domain_with_basic_expr
- , funcwrap<F>
- , env
- , A0>::type
- base_type;
- typedef Actor<base_type> result_type;
- typedef result_type type;
+#define PHOENIX_ITERATION_PARAMS \
+ (3, (1, PHOENIX_COMPOSITE_LIMIT, \
+ <boost/phoenix/core/compose.hpp>))
+#include PHOENIX_ITERATE()
- result_type
- operator()( typename call_traits<A0>::param_type a0 ) const
- {
- actor<base_type> const e = {{funcwrap<F>(), env(), a0}};
- return e;
- }
- };
+}}
- template <typename F, template<typename> class Actor,
- typename A0, typename A1>
- struct compose_ex<F, Actor, A0, A1>
- {
- typedef
- typename proto::result_of::make_expr<
- proto::tag::function
- , default_domain_with_basic_expr
- , funcwrap<F>
- , env
- , A0
- , A1>::type
- base_type;
- typedef Actor<base_type> result_type;
- typedef result_type type;
+#endif
- result_type
- operator()(
- typename call_traits<A0>::param_type a0,
- typename call_traits<A1>::param_type a1) const
- {
- actor<base_type> const e = {{funcwrap<F>(), env(), a0, a1}};
- return e;
- }
- };
+#else
- template <typename F, template<typename> class Actor,
- typename A0, typename A1, typename A2>
- struct compose_ex<F, Actor, A0, A1, A2>
+ template <typename F, template<typename> class Actor, PHOENIX_typename_A>
+ struct compose_ex<F, Actor, PHOENIX_A>
{
typedef
typename proto::result_of::make_expr<
@@ -121,61 +84,25 @@
, default_domain_with_basic_expr
, funcwrap<F>
, env
- , A0
- , A1
- , A2>::type
+ , PHOENIX_A>::type
base_type;
typedef Actor<base_type> result_type;
typedef result_type type;
result_type
- operator()(
- typename call_traits<A0>::param_type a0,
- typename call_traits<A1>::param_type a1,
- typename call_traits<A2>::param_type a2) const
+ operator()(
+ BOOST_PP_ENUM_BINARY_PARAMS(
+ PHOENIX_ITERATION,
+ typename call_traits< A, >::param_type a)) const
{
- actor<base_type> const e = {{funcwrap<F>(), env(), a0, a1, a2}};
+#if PHOENIX_ITERATION == 1
+ // silence gcc warnings
+ actor<base_type> const e = {{{funcwrap<F>()}, {env()}, {a0}}};
+#else
+ actor<base_type> const e = {{{funcwrap<F>()}, {env()}, PHOENIX_a}};
+#endif
return e;
}
};
-}}
-
-/*
-#define BOOST_PP_LOCAL_MACRO( N ) \
-namespace boost { namespace phoenix \
-{ \
- template <typename F, template<typename> class Actor \
- BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> \
- struct compose_ex<F, Actor BOOST_PP_ENUM_TRAILING_PARAMS(N, A)> \
- { \
- typedef \
- typename proto::result_of::make_expr< \
- proto::tag::function \
- , default_domain_with_basic_expr \
- , funcwrap< F > \
- , env BOOST_PP_ENUM_TRAILING_PARAMS(N, A) \
- >::type \
- base_type; \
- \
- typedef Actor<base_type> result_type; \
- typedef result_type type; \
- \
- result_type \
- operator()( \
- BOOST_PP_ENUM_BINARY_PARAMS(N, \
- typename call_traits< A, >::param_type a)) const \
- { \
- actor<base_type> const e = {{ \
- funcwrap< F >(), env() BOOST_PP_ENUM_TRAILING_PARAMS(N, a) \
- }}; \
- return e; \
- } \
- }; \
-}}
-
-#define BOOST_PP_LOCAL_LIMITS ( 0, 3 )
-#include BOOST_PP_LOCAL_ITERATE()
-*/
-
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -4,11 +4,16 @@
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)
==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
#ifndef PHOENIX_CORE_ENVIRONMENT_HPP
#define PHOENIX_CORE_ENVIRONMENT_HPP
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
+#include <boost/phoenix/core/limits.hpp>
+#include <boost/phoenix/support/iterate.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace phoenix
@@ -41,24 +46,27 @@
}
};
- template <typename A0 = void, typename A1 = void
- /* ... more ... */,
- typename Dummy = void>
+ template <PHOENIX_typename_A_void(PHOENIX_ARG_LIMIT), typename Dummy = void>
struct make_basic_environment;
template <>
struct make_basic_environment<>
: mpl::identity<fusion::vector0<> > {};
-
- template <typename A0>
- struct make_basic_environment<A0>
- : mpl::identity<fusion::vector1<A0> > {};
-
- template <typename A0, typename A1>
- struct make_basic_environment<A0, A1>
- : mpl::identity<fusion::vector2<A0, A1> > {};
-
- /* ... more ... */
+
+#define PHOENIX_ITERATION_PARAMS \
+ (3, (1, PHOENIX_ARG_LIMIT, \
+ <boost/phoenix/core/environment.hpp>))
+#include PHOENIX_ITERATE()
+
}}
#endif
+
+#else
+
+ template <PHOENIX_typename_A>
+ struct make_basic_environment<PHOENIX_A>
+ : mpl::identity<
+ BOOST_PP_CAT(fusion::vector, PHOENIX_ITERATION)<PHOENIX_A> > {};
+
+#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -10,7 +10,7 @@
#include <boost/preprocessor/dec.hpp>
#if !defined(PHOENIX_LIMIT)
-# define PHOENIX_LIMIT 10
+# define PHOENIX_LIMIT 5
#elif (PHOENIX_LIMIT < 5)
# error "PHOENIX_LIMIT is set too low"
#endif
@@ -29,14 +29,23 @@
# error "PHOENIX_ACTOR_LIMIT is set too low"
#endif
+#if !defined(PHOENIX_PERFECT_FORWARD_LIMIT)
+# define PHOENIX_PERFECT_FORWARD_LIMIT 4
+#elif (PHOENIX_PERFECT_FORWARD_LIMIT > PHOENIX_ACTOR_LIMIT)
+# error "PHOENIX_PERFECT_FORWARD_LIMIT > PHOENIX_ACTOR_LIMIT"
+#elif (PHOENIX_PERFECT_FORWARD_LIMIT < 3)
+# error "PHOENIX_PERFECT_FORWARD_LIMIT is set too low"
+#endif
+
#if !defined(PHOENIX_COMPOSITE_LIMIT)
-# define PHOENIX_COMPOSITE_LIMIT PHOENIX_LIMIT
-#elif (PHOENIX_COMPOSITE_LIMIT < 5)
+# define PHOENIX_COMPOSITE_LIMIT 3
+#elif (PHOENIX_COMPOSITE_LIMIT < 3)
# error "PHOENIX_COMPOSITE_LIMIT is set too low"
#endif
#if !defined(PHOENIX_MEMBER_LIMIT)
-# define PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT))
+# define PHOENIX_MEMBER_LIMIT 3
+//BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT))
#elif (PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT)
# error "PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT"
#elif (PHOENIX_MEMBER_LIMIT < 3)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -59,7 +59,7 @@
return make_reference<T>()(t);
}
- template<typename T>
+ template <typename T>
typename make_reference<T const>::type
cref(T& t)
{
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/function/function.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/function/function.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/function/function.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -5,12 +5,17 @@
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)
==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
#ifndef PHOENIX_FUNCTION_FUNCTION_HPP
#define PHOENIX_FUNCTION_FUNCTION_HPP
-//#include <boost/phoenix/core/extension.hpp>
#include <boost/phoenix/core/domain.hpp>
-#include <boost/proto/proto.hpp>
+#include <boost/phoenix/core/limits.hpp>
+#include <boost/phoenix/support/iterate.hpp>
+#include <boost/proto/make_expr.hpp>
+#include <boost/proto/tags.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace phoenix
@@ -18,74 +23,61 @@
////////////////////////////////////////////////////////////////////////////
// Functions
////////////////////////////////////////////////////////////////////////////
+
+ namespace result_of
+ {
+ template <typename F,
+ PHOENIX_typename_A_void(PHOENIX_ACTOR_LIMIT),
+ typename Dummy = void>
+ struct function;
+
+ template <typename F>
+ struct function<F>
+ : proto::result_of::make_expr<
+ proto::tag::function
+ , phoenix_domain
+ , F>
+ {};
+
+#define PHOENIX_ITERATE_RESULT_OF 1
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_ACTOR_LIMIT, \
+ <boost/phoenix/function/function.hpp>, PHOENIX_ITERATE_RESULT_OF))
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_RESULT_OF
+
+ }
// functor which returns our lazy function call extension
template<typename F>
struct function
{
- //typedef extension<proto::tag::function> extension_type;
-
- typedef function<F> function_type;
-
function() {}
function(F f)
- : f(f)
+ : f(f)
{}
template<typename Sig>
struct result;
template<typename This>
- struct result<This()> //: boost::result_of<extension_type(F)>
- : proto::result_of::make_expr<proto::tag::function, phoenix_domain, F>
+ struct result<This()>
+ : result_of::function<F>
{};
- template<typename This, typename A0>
- struct result<This(A0 const &)> //: boost::result_of<extension_type(F, A0 const &)>
- : proto::result_of::make_expr<proto::tag::function, phoenix_domain, F, A0>
- {};
-
- template<typename This, typename A0, typename A1>
- struct result<This(A0 const &, A1 const &)>
- //: boost::result_of<extension_type(F, A0 const &, A1 const &)>
- : proto::result_of::make_expr<proto::tag::function, phoenix_domain, F, A0, A1>
- {};
-
- /* ... more ... */
-
- //typename boost::result_of<function_type()>::type
- typename proto::result_of::make_expr<
- proto::tag::function, phoenix_domain, F>::type const
+ typename result_of::function<F>::type const
operator()() const
{
- //return extension_type()(f);
return proto::make_expr<proto::tag::function, phoenix_domain>(f);
}
- template<typename A0>
- //typename boost::result_of<function_type(A0 const &)>::type const
- typename proto::result_of::make_expr<
- proto::tag::function, phoenix_domain, F, A0>::type const
- operator()(A0 const & a0) const
- {
- //return extension_type()(f, a0);
- return proto::make_expr<
- proto::tag::function, phoenix_domain>(f, a0);
- }
-
- template<typename A0, typename A1>
- //typename boost::result_of<function_type(A0 const &, A1 const &)>::type
- typename proto::result_of::make_expr<
- proto::tag::function, phoenix_domain, F, A0, A1>::type const
- operator()(A0 const & a0, A1 const & a1) const
- {
- //return extension_type()(f, a0, a1);
- return proto::make_expr<
- proto::tag::function, phoenix_domain>(f, a0, a1);
- }
-
- /* ... more ... */
+#define PHOENIX_ITERATE_OPERATOR 2
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_ACTOR_LIMIT, \
+ <boost/phoenix/function/function.hpp>, PHOENIX_ITERATE_OPERATOR))
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_OPERATOR
F f;
};
@@ -94,11 +86,41 @@
template<typename F>
struct result_of<phoenix::function<F>()>
- {
- typedef phoenix::function<F> Fun;
- typedef typename Fun::template result<Fun()>::type type;
- };
+ : phoenix::result_of::function<F>
+ {};
}
#endif
+
+#else
+
+#if BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_RESULT_OF
+
+ template <typename F, PHOENIX_typename_A>
+ struct function<F, PHOENIX_A>
+ : proto::result_of::make_expr<
+ proto::tag::function
+ , phoenix_domain
+ , F
+ , PHOENIX_A>
+ {};
+
+#elif BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_OPERATOR
+
+ template<typename This, PHOENIX_typename_A>
+ struct result<This(PHOENIX_A_const_ref)>
+ : result_of::function<F, PHOENIX_A>
+ {};
+
+ template< PHOENIX_typename_A>
+ typename result_of::function<F, PHOENIX_A>::type const
+ operator()(PHOENIX_A_const_ref_a) const
+ {
+ return proto::make_expr<
+ proto::tag::function, phoenix_domain>(f, PHOENIX_a);
+ }
+
+#endif
+
+#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -9,5 +9,7 @@
#include <boost/phoenix/version.hpp>
#include <boost/phoenix/operator/operator.hpp>
+#include <boost/phoenix/operator/io.hpp>
+#include <boost/phoenix/operator/member.hpp>
#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/io.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/io.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,83 @@
+/*==============================================================================
+ 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_OPERATOR_IO_HPP
+#define PHOENIX_OPERATOR_IO_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/domain.hpp>
+#include <boost/proto/make_expr.hpp>
+#include <boost/proto/tags.hpp>
+
+namespace boost { namespace phoenix
+{
+ namespace detail
+ {
+ typedef std::ios_base& (*iomanip_type)(std::ios_base&);
+ typedef std::istream& (*imanip_type)(std::istream&);
+ typedef std::ostream& (*omanip_type)(std::ostream&);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // overloads for I/O manipulators.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ typename proto::result_of::make_expr<
+ proto::tag::shift_left
+ , phoenix_domain
+ , actor<Expr>
+ , detail::iomanip_type
+ >::type const
+ operator<<(actor<Expr> const& a0, detail::iomanip_type a1)
+ {
+ return proto::make_expr<
+ proto::tag::shift_left, phoenix_domain>(a0, a1);
+ }
+
+ template <typename Expr>
+ typename proto::result_of::make_expr<
+ proto::tag::shift_left
+ , phoenix_domain
+ , actor<Expr>
+ , detail::omanip_type
+ >::type const
+ operator<<(actor<Expr> const& a0, detail::omanip_type a1)
+ {
+ return proto::make_expr<
+ proto::tag::shift_left, phoenix_domain>(a0, a1);
+ }
+
+ template <typename Expr>
+ typename proto::result_of::make_expr<
+ proto::tag::shift_right
+ , phoenix_domain
+ , actor<Expr>
+ , detail::iomanip_type
+ >::type const
+ operator>>(actor<Expr> const& a0, detail::iomanip_type a1)
+ {
+ return proto::make_expr<
+ proto::tag::shift_right, phoenix_domain>(a0, a1);
+ }
+
+ template <typename Expr>
+ typename proto::result_of::make_expr<
+ proto::tag::shift_right
+ , phoenix_domain
+ , actor<Expr>
+ , detail::imanip_type
+ >::type const
+ operator>>(actor<Expr> const& a0, detail::imanip_type a1)
+ {
+ return proto::make_expr<
+ proto::tag::shift_right, phoenix_domain>(a0, a1);
+ }
+}}
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,126 @@
+/*==============================================================================
+ 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)
+==============================================================================*/
+
+#if !PHOENIX_IS_ITERATING
+
+#ifndef PHOENIX_OPERATOR_MEMBER_HPP
+#define PHOENIX_OPERATOR_MEMBER_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/domain.hpp>
+#include <boost/phoenix/support/iterate.hpp>
+#include <boost/proto/make_expr.hpp>
+#include <boost/proto/tags.hpp>
+#include <boost/type_traits/is_member_function_pointer.hpp>
+
+namespace boost { namespace phoenix
+{
+ namespace detail
+ {
+ namespace result_of
+ {
+ template <typename Object, typename MemPtr,
+ PHOENIX_typename_A_void(PHOENIX_MEMBER_LIMIT)
+ , typename Dummy = void>
+ struct mem_ptr;
+
+ template <typename Object, typename MemPtr>
+ struct mem_ptr<Object, MemPtr>
+ : proto::result_of::make_expr<
+ proto::tag::function
+ , phoenix_domain
+ , MemPtr
+ , Object>
+ {};
+
+#define PHOENIX_ITERATE_RESULT_OF 1
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_MEMBER_LIMIT, \
+ <boost/phoenix/operator/member.hpp>, \
+ PHOENIX_ITERATE_RESULT_OF))
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_RESULT_OF
+
+ }
+
+ template <typename Object, typename MemPtr>
+ struct mem_ptr
+ {
+ mem_ptr(Object const& obj, MemPtr ptr)
+ : obj(obj)
+ , ptr(ptr)
+ {}
+
+ typename result_of::mem_ptr<Object, MemPtr>::type const
+ operator()() const
+ {
+ return proto::make_expr<
+ proto::tag::function, phoenix_domain>(ptr, obj);
+ }
+
+#define PHOENIX_ITERATE_OPERATOR 2
+#define PHOENIX_ITERATION_PARAMS \
+ (4, (1, PHOENIX_MEMBER_LIMIT, \
+ <boost/phoenix/operator/member.hpp>, \
+ PHOENIX_ITERATE_OPERATOR))
+#include PHOENIX_ITERATE()
+#undef PHOENIX_ITERATE_OPERATOR
+
+ Object const& obj;
+ MemPtr ptr;
+
+ };
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // This operator overload is preferred to Proto's when the second parameter
+ // is a member function pointer. If it is a member object pointer, Proto's
+ // default handling will do the right thing.
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ template <typename Object, typename MemPtr>
+ typename enable_if<
+ is_member_function_pointer<MemPtr>
+ , detail::mem_ptr<actor<Object>, MemPtr> const
+ >::type
+ operator->*(actor<Object> const& obj, MemPtr ptr)
+ {
+ return detail::mem_ptr<actor<Object>, MemPtr>(obj, ptr);
+ }
+
+}}
+
+#endif
+
+#else
+
+#if BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_RESULT_OF
+
+ template <typename Object, typename MemPtr, PHOENIX_typename_A>
+ struct mem_ptr<Object, MemPtr, PHOENIX_A>
+ : proto::result_of::make_expr<
+ proto::tag::function
+ , phoenix_domain
+ , MemPtr
+ , Object
+ , PHOENIX_A>
+ {};
+
+#elif BOOST_PP_ITERATION_FLAGS() == PHOENIX_ITERATE_OPERATOR
+
+ template <PHOENIX_typename_A>
+ typename result_of::mem_ptr<Object, MemPtr, PHOENIX_A>::type const
+ operator()(PHOENIX_A_const_ref_a) const
+ {
+ return proto::make_expr<
+ proto::tag::function, phoenix_domain>(ptr, obj, PHOENIX_a);
+ }
+
+#endif
+#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/statement/if.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/statement/if.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/statement/if.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -32,7 +32,11 @@
template<typename Env, typename Cond, typename Then, typename Else>
void
- operator()(Env & env, Cond const & cond, Then const & then, Else const & else_) const
+ operator()(
+ Env & env
+ , Cond const & cond
+ , Then const & then
+ , Else const & else_) const
{
if( eval( cond, env ) )
eval( then, env );
@@ -90,8 +94,8 @@
, else_(element_at_c<0>(*this), element_at_c<1>(*this))
{}
- typedef typename boost::phoenix::result_of::element_value_at_c<Expr, 0>::type cond_type;
- typedef typename boost::phoenix::result_of::element_value_at_c<Expr, 1>::type then_type;
+ typedef typename result_of::element_value_at_c<Expr, 0>::type cond_type;
+ typedef typename result_of::element_value_at_c<Expr, 1>::type then_type;
else_gen<cond_type, then_type> else_;
};
@@ -118,7 +122,7 @@
};
template<typename Cond>
- if_gen<Cond>
+ if_gen<Cond> const
if_(Cond const & cond)
{
return if_gen<Cond>(cond);
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/support/detail/iterate.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/support/detail/iterate.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,213 @@
+/*==============================================================================
+ 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)
+==============================================================================*/
+
+#if !BOOST_PP_IS_ITERATING
+
+#ifndef PHOENIX_SUPPORT_DETAIL_ITERATE_HPP
+#define PHOENIX_SUPPORT_DETAIL_ITERATE_HPP
+#endif
+
+#ifndef PHOENIX_ITERATION_PARAMS
+#error "PHOENIX_ITERATION_PARAMS not define"
+#endif
+
+#define PHOENIX_ITERATION_PARAMS_SIZE \
+ BOOST_PP_TUPLE_ELEM(2, 0, PHOENIX_ITERATION_PARAMS)
+
+#define PHOENIX_ITERATION_TUPLE \
+ BOOST_PP_TUPLE_ELEM(2, 1, PHOENIX_ITERATION_PARAMS)
+
+#define PHOENIX_ITERATION_START \
+ BOOST_PP_TUPLE_ELEM( \
+ PHOENIX_ITERATION_PARAMS_SIZE, 0, PHOENIX_ITERATION_TUPLE)
+
+#define PHOENIX_ITERATION_END \
+ BOOST_PP_TUPLE_ELEM( \
+ PHOENIX_ITERATION_PARAMS_SIZE, 1, PHOENIX_ITERATION_TUPLE)
+
+
+#define PHOENIX_ITERATION_FILE() \
+ BOOST_PP_TUPLE_ELEM( \
+ PHOENIX_ITERATION_PARAMS_SIZE, 2, PHOENIX_ITERATION_TUPLE)
+
+#if PHOENIX_ITERATION_PARAMS_SIZE == 3
+
+#define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (PHOENIX_ITERATION_START, PHOENIX_ITERATION_END, \
+ <boost/phoenix/support/detail/iterate.hpp>))
+
+#else
+
+#define PHOENIX_ITERATION_FLAG \
+ BOOST_PP_TUPLE_ELEM( \
+ PHOENIX_ITERATION_PARAMS_SIZE, 3, PHOENIX_ITERATION_TUPLE)
+
+#define BOOST_PP_ITERATION_PARAMS_1 \
+ (4, (PHOENIX_ITERATION_START, PHOENIX_ITERATION_END, \
+ <boost/phoenix/support/detail/iterate.hpp>, \
+ PHOENIX_ITERATION_FLAG))
+
+#endif
+
+#include BOOST_PP_ITERATE()
+
+#undef PHOENIX_ITERATION_PARAMS_SIZE
+#undef PHOENIX_ITERATION_TUPLE
+#undef PHOENIX_ITERATION_START
+#undef PHOENIX_ITERATION_END
+#undef PHOENIX_ITERATION_PARAMS
+
+#else
+
+#undef PHOENIX_IS_ITERATING
+#define PHOENIX_IS_ITERATING 1
+
+#define PHOENIX_ITERATION BOOST_PP_ITERATION()
+
+#undef PHOENIX_typename_A
+#undef PHOENIX_typename_A_void
+#undef PHOENIX_A
+#undef PHOENIX_A_a
+#undef PHOENIX_A_ref
+#undef PHOENIX_A_const_ref
+#undef PHOENIX_A_ref_a
+#undef PHOENIX_A_const_ref_a
+#undef PHOENIX_a
+
+#define PHOENIX_typename_A BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename A)
+
+#define PHOENIX_typename_A_void \
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_ITERATION, typename A, void)
+
+#define PHOENIX_A \
+ BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, A)
+
+#define PHOENIX_A_ref \
+ BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, A, & BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_const_ref \
+ BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, A, const& BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_a BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, A, a)
+
+#define PHOENIX_A_ref_a BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, A, & a)
+
+#define PHOENIX_A_const_ref_a \
+ BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, A, const& a)
+
+#define PHOENIX_a \
+ BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, a)
+
+#define PHOENIX_M0_R_P(_, PRODUCT) (PRODUCT)
+
+#define PHOENIX_M0_R(_, N, __) \
+ (BOOST_PP_SEQ_FOR_EACH_PRODUCT( PHOENIX_M0_R_P, ((A ## N))((&)(const&))))
+
+#define PHOENIX_M0 BOOST_PP_REPEAT(PHOENIX_ITERATION, PHOENIX_M0_R, _)
+
+#define PHOENIX_M1_R_F(_, STATE, ELEM) STATE ELEM
+
+#define PHOENIX_M1_R(_, __, ___, ELEM) \
+ (BOOST_PP_SEQ_FOLD_RIGHT \
+ (PHOENIX_M1_R_F, BOOST_PP_SEQ_HEAD(ELEM), BOOST_PP_SEQ_TAIL(ELEM)))
+
+#define PHOENIX_M1(R, PRODUCT) \
+ ((BOOST_PP_SEQ_ENUM \
+ (BOOST_PP_SEQ_FOR_EACH_I_R \
+ (R, PHOENIX_M1_R, BOOST_PP_SEQ_SIZE( PRODUCT ), PRODUCT))))
+
+#define PHOENIX_M2_R(_, __, I, ELEM) \
+ BOOST_PP_COMMA_IF(I) \
+ BOOST_PP_SEQ_FOLD_LEFT \
+ (PHOENIX_M1_R_F, BOOST_PP_SEQ_HEAD(ELEM), BOOST_PP_SEQ_TAIL(ELEM)) \
+ a ## I
+
+#define PHOENIX_M2(R, PRODUCT) \
+ ((BOOST_PP_SEQ_FOR_EACH_I_R(R, PHOENIX_M2_R, _, PRODUCT)))
+
+#define PHOENIX_SEQ_A BOOST_PP_SEQ_FOR_EACH_PRODUCT(PHOENIX_M1, PHOENIX_M0)
+
+#define PHOENIX_SEQ_A_a BOOST_PP_SEQ_FOR_EACH_PRODUCT(PHOENIX_M2, PHOENIX_M0)
+
+#define PHOENIX_PERM_SIZE BOOST_PP_SEQ_SIZE(PHOENIX_SEQ_A)
+
+#ifdef BOOST_MSVC
+
+#define PHOENIX_PERM_A(N) \
+ BOOST_PP_TUPLE_REM(PHOENIX_ITERATION) BOOST_PP_SEQ_ELEM(N, PHOENIX_SEQ_A)
+
+#define PHOENIX_PERM_A_a(N) \
+ BOOST_PP_TUPLE_REM(PHOENIX_ITERATION) BOOST_PP_SEQ_ELEM(N, PHOENIX_SEQ_A_a)
+
+#else
+
+#define PHOENIX_PERM_A(N) BOOST_PP_EXPAND \
+ (BOOST_PP_TUPLE_REM(PHOENIX_ITERATION) BOOST_PP_SEQ_ELEM(N, PHOENIX_SEQ_A))
+
+#define PHOENIX_PERM_A_a(N) BOOST_PP_EXPAND \
+ (BOOST_PP_TUPLE_REM(PHOENIX_ITERATION) BOOST_PP_SEQ_ELEM(N, PHOENIX_SEQ_A_a))
+
+#endif
+
+#include PHOENIX_ITERATION_FILE()
+
+#undef PHOENIX_ITERATION
+#undef PHOENIX_typename_A
+#undef PHOENIX_typename_A_void
+#undef PHOENIX_A
+#undef PHOENIX_PERM_A
+#undef PHOENIX_A_a
+#undef PHOENIX_A_ref
+#undef PHOENIX_A_const_ref
+#undef PHOENIX_A_ref_a
+#undef PHOENIX_A_const_ref_a
+#undef PHOENIX_PERM_A_a
+#undef PHOENIX_a
+
+#define PHOENIX_ITERATE() \
+ <boost/phoenix/support/detail/iterate.hpp>
+
+#define PHOENIX_typename_A(N) BOOST_PP_ENUM_PARAMS(N, typename A)
+
+#define PHOENIX_typename_A_void(N) \
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(N, typename A, void)
+
+#define PHOENIX_A(N) \
+ BOOST_PP_ENUM_PARAMS(N, A)
+
+#define PHOENIX_A_ref(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, & BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_const_ref(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_a(N) BOOST_PP_ENUM_BINARY_PARAMS(N, A, a)
+
+#define PHOENIX_A_ref_a(N) BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)
+
+#define PHOENIX_A_const_ref_a(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a)
+
+#define PHOENIX_a(N) \
+ BOOST_PP_ENUM_PARAMS(N, a)
+
+#undef PHOENIX_M0_R_P
+#undef PHOENIX_M0_R
+#undef PHOENIX_M0
+#undef PHOENIX_M1_R_F
+#undef PHOENIX_M1_R
+#undef PHOENIX_M1
+#undef PHOENIX_M2_R
+#undef PHOENIX_M2
+#undef PHOENIX_SEQ_A
+#undef PHOENIX_SEQ_A_a
+#undef PHOENIX_PERM_SIZE
+
+#undef PHOENIX_IS_ITERATING
+#define PHOENIX_IS_ITERATING 0
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/support/iterate.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/support/iterate.hpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -0,0 +1,46 @@
+/*==============================================================================
+ 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_SUPPORT_ITERATE_HPP
+#define PHOENIX_SUPPORT_ITERATE_HPP
+
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/tuple/elem.hpp>
+
+#define PHOENIX_IS_ITERATING 0
+
+#define PHOENIX_ITERATE() \
+ <boost/phoenix/support/detail/iterate.hpp>
+
+#define PHOENIX_typename_A(N) BOOST_PP_ENUM_PARAMS(N, typename A)
+
+#define PHOENIX_typename_A_void(N) \
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(N, typename A, void)
+
+#define PHOENIX_A(N) \
+ BOOST_PP_ENUM_PARAMS(N, A)
+
+#define PHOENIX_A_ref(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, & BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_const_ref(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& BOOST_PP_INTERCEPT)
+
+#define PHOENIX_A_a(N) BOOST_PP_ENUM_BINARY_PARAMS(N, A, a)
+
+#define PHOENIX_A_ref_a(N) BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)
+
+#define PHOENIX_A_const_ref_a(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a)
+
+#define PHOENIX_a(N) \
+ BOOST_PP_ENUM_PARAMS(N, a)
+
+#endif
+
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/bind/bind_function_object_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/bind/bind_function_object_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/bind/bind_function_object_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -11,9 +11,9 @@
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/bind.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
+using std::cout;
+using std::pow;
struct test
{
@@ -38,7 +38,6 @@
template <typename Arg>
Arg operator()(Arg n) const
{
- std::cout << boost::is_reference< Arg >::value << " <-- Arg is reference :(\n";
return n * n;
}
};
@@ -79,11 +78,13 @@
}
};
- /*
struct add
{
- template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
- struct result
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+ struct result<This(Arg1&, Arg2&, Arg3&, Arg4&)>
{
typedef Arg1 type;
};
@@ -94,11 +95,16 @@
return a + b + c + d;
}
};
- */
int
main()
{
+ using phoenix::bind;
+ using phoenix::ref;
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
+
int i5 = 5;
double d5 = 5, d3 = 3;
@@ -107,8 +113,8 @@
BOOST_TEST(bind(fact(), 4)() == 24);
BOOST_TEST(bind(fact(), arg1)(i5) == 120);
BOOST_TEST((int)bind(power(), arg1, arg2)(d5, d3) == (int)pow(d5, d3));
- //BOOST_TEST((bind(sqr(), arg1) + 5)(i5) == ((i5*i5)+5));
- //BOOST_TEST(bind(add(), arg1, arg1, arg1, arg1)(i5) == (5+5+5+5)); // not implemented yet
+ BOOST_TEST((bind(sqr(), arg1) + 5)(i5) == ((i5*i5)+5));
+ BOOST_TEST(bind(add(), arg1, arg1, arg1, arg1)(i5) == (5+5+5+5));
int const ic5 = 5;
// testing consts
@@ -117,8 +123,8 @@
// From Steven Watanabe
sqr s;
int x = 2;
- //int result = bind(ref(s), _1)(x);
- //BOOST_TEST(result == 4);
+ int result = bind(ref(s), _1)(x);
+ BOOST_TEST(result == 4);
return boost::report_errors();
}
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/core/primitives_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/core/primitives_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/core/primitives_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -35,7 +35,7 @@
// value
//cout << val("Hello,")(0) << val(' ')(0) << val("World")(0) << endl;
- BOOST_TEST(val(3)(0) == 3);
+ BOOST_TEST(val(3)() == 3);
//BOOST_TEST(val("Hello, world")(0) == std::string("Hello, world"));
//BOOST_TEST(val(_1)(i1) == i1);
@@ -45,10 +45,10 @@
#endif
// reference
- BOOST_TEST(cref(i)(0) == ref(i)(0));
- BOOST_TEST(cref(i)(0) == 4);
+ BOOST_TEST(cref(i)() == ref(i)());
+ BOOST_TEST(cref(i)() == 4);
BOOST_TEST(i == 4);
- BOOST_TEST(ref(++i)(0) == 5);
+ BOOST_TEST(ref(++i)() == 5);
BOOST_TEST(i == 5);
// should not compile:
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/function/function_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/function/function_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/function/function_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -87,11 +87,13 @@
function<pow_impl> power;
- /*
struct add_impl
{
- template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
- struct result
+ template<typename Sig>
+ struct result;
+
+ template <typename This, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+ struct result<This(Arg1&, Arg2&, Arg3&, Arg4&)>
{
typedef Arg1 type;
};
@@ -104,7 +106,6 @@
};
function<add_impl> add;
- */
int
main()
@@ -112,13 +113,13 @@
int i5 = 5;
double d5 = 5, d3 = 3;
- test()(0);
+ test()();
BOOST_TEST(sqr(arg1)(i5) == (i5*i5));
BOOST_TEST(fact(4)() == 24);
BOOST_TEST(fact(arg1)(i5) == 120);
BOOST_TEST((int)power(arg1, arg2)(d5, d3) == (int)pow(d5, d3));
BOOST_TEST((sqr(arg1) + 5)(i5) == ((i5*i5)+5));
- //BOOST_TEST(add(arg1, arg1, arg1, arg1)(i5) == (5+5+5+5));
+ BOOST_TEST(add(arg1, arg1, arg1, arg1)(i5) == (5+5+5+5));
int const ic5 = 5;
// testing consts
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -8,12 +8,14 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::ref;
+ using phoenix::val;
+
{
int x = 123;
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/bitwise_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/bitwise_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/bitwise_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -9,13 +9,16 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::ref;
+ using phoenix::val;
+ using phoenix::arg_names::arg1;
+ using std::cout;
+
{
int x;
int y;
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/comparison_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/comparison_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/comparison_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -8,12 +8,13 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::val;
+
{
BOOST_TEST(!(val(123) == 456)());
BOOST_TEST((val(123) != 456)());
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/if_else_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/if_else_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/if_else_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -8,13 +8,15 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::if_else;
+ using phoenix::ref;
+ using phoenix::val;
+ using phoenix::arg_names::arg1;
{
int x = 0;
int y = 0;
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/io_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/io_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/io_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -15,15 +15,22 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-#include <boost/fusion/include/io.hpp>
-
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::val;
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
+ using std::cout;
+ using std::endl;
+ using std::hex;
+ using std::for_each;
+ using std::string;
+ using std::stringstream;
+ using std::vector;
+
int i100 = 100;
string hello = "hello";
const char* world = " world";
@@ -33,22 +40,22 @@
char const* msg = "cout assert\n";
(cout << arg1)(msg);
- //(cout << arg1 << endl)(hello);
- //(arg1 << hex)(cout);
+ (cout << arg1 << endl)(hello);
+ (arg1 << hex)(cout);
(cout << val(hello))();
(cout << val(hello) << world << ", you da man!\n")();
for_each(v.begin(), v.end(), cout << arg1 << ',');
(cout << arg1 + 1)(i100);
- //(cout << arg1 << "this is it, shukz:" << hex << arg2 << endl << endl)(msg, i100);
+ (cout << arg1 << "this is it, shukz:" << hex << arg2 << endl << endl)(msg, i100);
int in;
int out = 12345;
stringstream sstr;
(sstr << arg1)(out);
- //(sstr >> arg1)(in);
- //BOOST_TEST(in == out);
+ (sstr >> arg1)(in);
+ BOOST_TEST(in == out);
return boost::report_errors();
}
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/logical_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/logical_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/logical_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -8,13 +8,13 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
{
bool x = false;
bool y = true;
@@ -26,10 +26,10 @@
// short circuiting:
int i = 1234;
- //(arg1 || (arg2 = 4567))(y, i);
+ (arg1 || (arg2 = 4567))(y, i);
BOOST_TEST(i == 1234);
- //(arg1 && (arg2 = 4567))(y, i);
- //BOOST_TEST(i == 4567);
+ (arg1 && (arg2 = 4567))(y, i);
+ BOOST_TEST(i == 4567);
}
return boost::report_errors();
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -27,11 +27,16 @@
};
}
+namespace phoenix = boost::phoenix;
+
int main()
{
- using namespace boost::phoenix;
- using namespace boost::phoenix::arg_names;
- using namespace boost;
+ using boost::scoped_ptr;
+ using boost::shared_ptr;
+ using phoenix::val;
+ using phoenix::ref;
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
Test test = {1};
const Test* cptr = &test;
@@ -44,44 +49,44 @@
((val(ptr)->*&Test::value) = 2)();
BOOST_TEST(test.value == 2);
- BOOST_TEST((val(ptr)->*&Test::func)()(3) == 3);
+ BOOST_TEST((val(ptr)->*&Test::func)(3)() == 3);
int i = 33;
- //BOOST_TEST((arg1->*&Test::func)(arg2)(cptr, i) == i);
- BOOST_TEST((val(cptr)->*&Test::func)()(4) == 4);
+ BOOST_TEST((arg1->*&Test::func)(arg2)(cptr, i) == i);
+ BOOST_TEST((val(cptr)->*&Test::func)(4)() == 4);
BOOST_TEST((val(ptr)->*&Test::dunc)()() == 10);
- //BOOST_TEST((arg1->*&Test::func)(5)(ptr) == 5);
- //BOOST_TEST((arg1->*&Test::kunc)()(ptr));
+ BOOST_TEST((arg1->*&Test::func)(5)(ptr) == 5);
+ BOOST_TEST((arg1->*&Test::kunc)()(ptr));
shared_ptr<Test> sptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(sptr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(6)(sptr) == 6);
+ BOOST_TEST((arg1->*&Test::func)(6)(sptr) == 6);
scoped_ptr<Test> scptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(scptr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(7)(scptr) == 7);
+ BOOST_TEST((arg1->*&Test::func)(7)(scptr) == 7);
shared_ptr<const Test> csptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(csptr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(8)(csptr) == 8);
+ BOOST_TEST((arg1->*&Test::func)(8)(csptr) == 8);
scoped_ptr<const Test> cscptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(cscptr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(9)(cscptr) == 9);
+ BOOST_TEST((arg1->*&Test::func)(9)(cscptr) == 9);
std::auto_ptr<Test> aptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(aptr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(10)(aptr) == 10);
+ BOOST_TEST((arg1->*&Test::func)(10)(aptr) == 10);
std::auto_ptr<const Test> captr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(captr) == 2);
- //BOOST_TEST((arg1->*&Test::func)(11)(captr) == 11);
+ BOOST_TEST((arg1->*&Test::func)(11)(captr) == 11);
return 0;
}
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/misc_binary_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/misc_binary_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/misc_binary_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -10,13 +10,16 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::placeholders;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::ref;
+ using phoenix::val;
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
+ using std::string;
{ // From Phoenix 1.1 binary tests
int i2 = 2, i3 = 3, i = 5;
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/self_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/self_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/self_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -11,13 +11,18 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::ref;
+ using phoenix::arg_names::arg1;
+ using phoenix::arg_names::arg2;
+ using std::map;
+ using std::string;
+ using std::vector;
+
{
int x = 123;
BOOST_TEST((&arg1)(x) == &x);
@@ -27,17 +32,16 @@
(ref(x) = arg1)(y);
BOOST_TEST(x == y);
- //(arg1 = 456)(x);
- //BOOST_TEST(x == 456);
- //int& r = (arg1 = 456)(x); // must be an lvalue
- //BOOST_TEST(&r == &x);
+ (arg1 = 456)(x);
+ BOOST_TEST(x == 456);
+ int& r = (arg1 = 456)(x); // must be an lvalue
+ BOOST_TEST(&r == &x);
int c[] = { 1, 2, 3, 4, 5 };
BOOST_TEST((arg1[3])(c) == 4);
- //int& r2 = (arg1[3])(c); // must be an lvalue
- int const & r2 = (arg1[3])(c); // must be an lvalue
- //BOOST_TEST(&r2 == &c[3]);
+ int& r2 = (arg1[3])(c); // must be an lvalue
+ BOOST_TEST(&r2 == &c[3]);
vector<string> v;
v.push_back("a");
@@ -48,8 +52,8 @@
BOOST_TEST((arg1[3])(v) == "d");
map<string, int> m;
- //(arg1["Kimpo"] = arg2)(m, x);
- //BOOST_TEST(m["Kimpo"] == x);
+ (arg1["Kimpo"] = arg2)(m, x);
+ BOOST_TEST(m["Kimpo"] == x);
}
return boost::report_errors();
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/unary_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/unary_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/unary_tests.cpp 2010-06-16 17:43:16 EDT (Wed, 16 Jun 2010)
@@ -8,13 +8,14 @@
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
-using namespace boost::phoenix;
-using namespace boost::phoenix::arg_names;
-using namespace std;
+namespace phoenix = boost::phoenix;
int
main()
{
+ using phoenix::val;
+ using phoenix::ref;
+ using phoenix::arg_names::arg1;
{
BOOST_TEST((-val(123))() == -123);
BOOST_TEST((- -val(123))() == 123);
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