Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63555 - in branches/release: . boost boost/algorithm/string boost/archive boost/bimap boost/config boost/detail boost/filesystem boost/functional/hash boost/fusion boost/gil boost/graph boost/integer boost/interprocess boost/intrusive boost/iostreams boost/lambda boost/lambda/detail boost/msm boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/range boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/statechart boost/system boost/thread boost/unordered boost/utility boost/uuid boost/variant boost/wave libs libs/array/test libs/bimap libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/lambda/test libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/msm libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/python libs/range libs/range/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/statechart libs/static_assert libs/system libs/thread libs/timer libs/unordered libs/utility libs/utility/swap/test libs/uuid libs/wave more more/getting_started status tools tools/bcp tools/build/v2 tools/build/v2/tools tools/jam tools/regression tools/release tools/wave
From: steven_at_[hidden]
Date: 2010-07-03 15:05:17


Author: steven_watanabe
Date: 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
New Revision: 63555
URL: http://svn.boost.org/trac/boost/changeset/63555

Log:
Merge lambda from the trunk
Added:
   branches/release/libs/lambda/test/result_of_tests.cpp
      - copied unchanged from r62627, /trunk/libs/lambda/test/result_of_tests.cpp
Removed:
   branches/release/boost/lambda/detail/control_structures_impl.hpp
Properties modified:
   branches/release/ (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/config.hpp (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/detail/endian.hpp (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/gil/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/iostreams/ (props changed)
   branches/release/boost/msm/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/range/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/serialization/factory.hpp (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/utility/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/array/test/array2.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/msm/ (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/range/ (props changed)
   branches/release/libs/range/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/statechart/ (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/utility/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/swap/test/std_bitset.cpp (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/more/getting_started/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/build/v2/tools/ (props changed)
   branches/release/tools/jam/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
Text files modified:
   branches/release/boost/lambda/casts.hpp | 4 +
   branches/release/boost/lambda/closures.hpp | 2
   branches/release/boost/lambda/construct.hpp | 3
   branches/release/boost/lambda/control_structures.hpp | 3
   branches/release/boost/lambda/detail/function_adaptors.hpp | 158 +++++++++++++++++++++++++++++++++++++--
   branches/release/boost/lambda/detail/lambda_functor_base.hpp | 10 ++
   branches/release/boost/lambda/detail/lambda_functors.hpp | 19 ++++
   branches/release/boost/lambda/detail/lambda_traits.hpp | 1
   branches/release/boost/lambda/detail/operators.hpp | 6
   branches/release/boost/lambda/detail/return_type_traits.hpp | 2
   branches/release/boost/lambda/exceptions.hpp | 1
   branches/release/libs/lambda/test/Jamfile | 1
   branches/release/libs/lambda/test/bind_tests_advanced.cpp | 67 +++++++++++++---
   branches/release/libs/lambda/test/cast_test.cpp | 2
   branches/release/libs/lambda/test/operator_tests_simple.cpp | 16 ++++
   15 files changed, 265 insertions(+), 30 deletions(-)

Modified: branches/release/boost/lambda/casts.hpp
==============================================================================
--- branches/release/boost/lambda/casts.hpp (original)
+++ branches/release/boost/lambda/casts.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -15,12 +15,16 @@
 #define BOOST_LAMBDA_CASTS_HPP
 
 #include "boost/lambda/detail/suppress_unused.hpp"
+#include "boost/lambda/core.hpp"
 
 #include <typeinfo>
 
 namespace boost {
 namespace lambda {
 
+template<class Act, class Args>
+struct return_type_N;
+
 template<class T> class cast_action;
 
 template<class T> class static_cast_action;

Modified: branches/release/boost/lambda/closures.hpp
==============================================================================
--- branches/release/boost/lambda/closures.hpp (original)
+++ branches/release/boost/lambda/closures.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -251,7 +251,7 @@
     closure& operator=(closure const&); // no assign
 
     template <int N, typename ClosureT>
- friend struct closure_member;
+ friend class closure_member;
 
     template <typename ClosureT>
     friend class closure_frame;

Modified: branches/release/boost/lambda/construct.hpp
==============================================================================
--- branches/release/boost/lambda/construct.hpp (original)
+++ branches/release/boost/lambda/construct.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -14,6 +14,9 @@
 #if !defined(BOOST_LAMBDA_CONSTRUCT_HPP)
 #define BOOST_LAMBDA_CONSTRUCT_HPP
 
+#include "boost/type_traits/remove_cv.hpp"
+#include "boost/type_traits/is_pointer.hpp"
+
 namespace boost {
 namespace lambda {
 

Modified: branches/release/boost/lambda/control_structures.hpp
==============================================================================
--- branches/release/boost/lambda/control_structures.hpp (original)
+++ branches/release/boost/lambda/control_structures.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -17,6 +17,7 @@
 #include "boost/lambda/detail/operator_actions.hpp"
 #include "boost/lambda/detail/operator_return_type_traits.hpp"
 
-#include "boost/lambda/detail/control_structures_impl.hpp"
+#include "boost/lambda/if.hpp"
+#include "boost/lambda/loops.hpp"
 
 #endif

Deleted: branches/release/boost/lambda/detail/control_structures_impl.hpp
==============================================================================
--- branches/release/boost/lambda/detail/control_structures_impl.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
+++ (empty file)
@@ -1,550 +0,0 @@
-// Boost Lambda Library -- control_structures_impl.hpp ---------------------
-
-// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi_at_[hidden])
-// Copyright (C) 2000 Gary Powell (powellg_at_[hidden])
-//
-// 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 more information, see www.boost.org
-
-// --------------------------------------------------------------------------
-
-#if !defined(BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP)
-#define BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP
-
-namespace boost {
-namespace lambda {
-
-// -- void return control actions ----------------------
-
-class forloop_action {};
-class forloop_no_body_action {};
-class ifthen_action {};
-class ifthenelse_action {};
-class whileloop_action {};
-class whileloop_no_body_action {};
-class dowhileloop_action {};
-class dowhileloop_no_body_action {};
-// -- nonvoid return control actions ----------------------
-
-class ifthenelsereturn_action {};
-
-// For loop
-template <class Arg1, class Arg2, class Arg3, class Arg4>
-inline const
-lambda_functor<
- lambda_functor_base<
- forloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
- lambda_functor<Arg3>, lambda_functor<Arg4> >
- >
->
-for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
- const lambda_functor<Arg3>& a3, const lambda_functor<Arg4>& a4) {
- return
- lambda_functor_base<
- forloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
- lambda_functor<Arg3>, lambda_functor<Arg4> >
- >
- ( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
- lambda_functor<Arg3>, lambda_functor<Arg4> >(a1, a2, a3, a4)
- );
-}
-
-// No body case.
-template <class Arg1, class Arg2, class Arg3>
-inline const
-lambda_functor<
- lambda_functor_base<
- forloop_no_body_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
- >
->
-for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
- const lambda_functor<Arg3>& a3) {
- return
- lambda_functor_base<
- forloop_no_body_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
- lambda_functor<Arg3> >
- >
- ( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
- lambda_functor<Arg3> >(a1, a2, a3) );
-}
-
-// While loop
-template <class Arg1, class Arg2>
-inline const
-lambda_functor<
- lambda_functor_base<
- whileloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
->
-while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
- return
- lambda_functor_base<
- whileloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
- ( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
-}
-
-// No body case.
-template <class Arg1>
-inline const
-lambda_functor<
- lambda_functor_base<
- whileloop_no_body_action,
- tuple<lambda_functor<Arg1> >
- >
->
-while_loop(const lambda_functor<Arg1>& a1) {
- return
- lambda_functor_base<
- whileloop_no_body_action,
- tuple<lambda_functor<Arg1> >
- >
- ( tuple<lambda_functor<Arg1> >(a1) );
-}
-
-
-// Do While loop
-template <class Arg1, class Arg2>
-inline const
-lambda_functor<
- lambda_functor_base<
- dowhileloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
->
-do_while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
- return
- lambda_functor_base<
- dowhileloop_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
- ( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
-}
-
-// No body case.
-template <class Arg1>
-inline const
-lambda_functor<
- lambda_functor_base<
- dowhileloop_no_body_action,
- tuple<lambda_functor<Arg1> >
- >
->
-do_while_loop(const lambda_functor<Arg1>& a1) {
- return
- lambda_functor_base<
- dowhileloop_no_body_action,
- tuple<lambda_functor<Arg1> >
- >
- ( tuple<lambda_functor<Arg1> >(a1));
-}
-
-
-// If Then
-template <class Arg1, class Arg2>
-inline const
-lambda_functor<
- lambda_functor_base<
- ifthen_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
->
-if_then(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
- return
- lambda_functor_base<
- ifthen_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
- >
- ( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2) );
-}
-
-// If then else
-
-template <class Arg1, class Arg2, class Arg3>
-inline const
-lambda_functor<
- lambda_functor_base<
- ifthenelse_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
- >
->
-if_then_else(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
- const lambda_functor<Arg3>& a3) {
- return
- lambda_functor_base<
- ifthenelse_action,
- tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
- >
- (tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
- (a1, a2, a3) );
-}
-
-// Our version of operator?:()
-
-template <class Arg1, class Arg2, class Arg3>
-inline const
- lambda_functor<
- lambda_functor_base<
- other_action<ifthenelsereturn_action>,
- tuple<lambda_functor<Arg1>,
- typename const_copy_argument<Arg2>::type,
- typename const_copy_argument<Arg3>::type>
- >
->
-if_then_else_return(const lambda_functor<Arg1>& a1,
- const Arg2 & a2,
- const Arg3 & a3) {
- return
- lambda_functor_base<
- other_action<ifthenelsereturn_action>,
- tuple<lambda_functor<Arg1>,
- typename const_copy_argument<Arg2>::type,
- typename const_copy_argument<Arg3>::type>
- > ( tuple<lambda_functor<Arg1>,
- typename const_copy_argument<Arg2>::type,
- typename const_copy_argument<Arg3>::type> (a1, a2, a3) );
-}
-
-namespace detail {
-
-// return type specialization for conditional expression begins -----------
-// start reading below and move upwards
-
-// PHASE 6:1
-// check if A is conbertible to B and B to A
-template<int Phase, bool AtoB, bool BtoA, bool SameType, class A, class B>
-struct return_type_2_ifthenelsereturn;
-
-// if A can be converted to B and vice versa -> ambiguous
-template<int Phase, class A, class B>
-struct return_type_2_ifthenelsereturn<Phase, true, true, false, A, B> {
- typedef
- detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
- // ambiguous type in conditional expression
-};
-// if A can be converted to B and vice versa and are of same type
-template<int Phase, class A, class B>
-struct return_type_2_ifthenelsereturn<Phase, true, true, true, A, B> {
- typedef A type;
-};
-
-
-// A can be converted to B
-template<int Phase, class A, class B>
-struct return_type_2_ifthenelsereturn<Phase, true, false, false, A, B> {
- typedef B type;
-};
-
-// B can be converted to A
-template<int Phase, class A, class B>
-struct return_type_2_ifthenelsereturn<Phase, false, true, false, A, B> {
- typedef A type;
-};
-
-// neither can be converted. Then we drop the potential references, and
-// try again
-template<class A, class B>
-struct return_type_2_ifthenelsereturn<1, false, false, false, A, B> {
- // it is safe to add const, since the result will be an rvalue and thus
- // const anyway. The const are needed eg. if the types
- // are 'const int*' and 'void *'. The remaining type should be 'const void*'
- typedef const typename boost::remove_reference<A>::type plainA;
- typedef const typename boost::remove_reference<B>::type plainB;
- // TODO: Add support for volatile ?
-
- typedef typename
- return_type_2_ifthenelsereturn<
- 2,
- boost::is_convertible<plainA,plainB>::value,
- boost::is_convertible<plainB,plainA>::value,
- boost::is_same<plainA,plainB>::value,
- plainA,
- plainB>::type type;
-};
-
-// PHASE 6:2
-template<class A, class B>
-struct return_type_2_ifthenelsereturn<2, false, false, false, A, B> {
- typedef
- detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
- // types_do_not_match_in_conditional_expression
-};
-
-
-
-// PHASE 5: now we know that types are not arithmetic.
-template<class A, class B>
-struct non_numeric_types {
- typedef typename
- return_type_2_ifthenelsereturn<
- 1, // phase 1
- is_convertible<A,B>::value,
- is_convertible<B,A>::value,
- is_same<A,B>::value,
- A,
- B>::type type;
-};
-
-// PHASE 4 :
-// the base case covers arithmetic types with differing promote codes
-// use the type deduction of arithmetic_actions
-template<int CodeA, int CodeB, class A, class B>
-struct arithmetic_or_not {
- typedef typename
- return_type_2<arithmetic_action<plus_action>, A, B>::type type;
- // plus_action is just a random pick, has to be a concrete instance
-};
-
-// this case covers the case of artihmetic types with the same promote codes.
-// non numeric deduction is used since e.g. integral promotion is not
-// performed with operator ?:
-template<int CodeA, class A, class B>
-struct arithmetic_or_not<CodeA, CodeA, A, B> {
- typedef typename non_numeric_types<A, B>::type type;
-};
-
-// if either A or B has promote code -1 it is not an arithmetic type
-template<class A, class B>
-struct arithmetic_or_not <-1, -1, A, B> {
- typedef typename non_numeric_types<A, B>::type type;
-};
-template<int CodeB, class A, class B>
-struct arithmetic_or_not <-1, CodeB, A, B> {
- typedef typename non_numeric_types<A, B>::type type;
-};
-template<int CodeA, class A, class B>
-struct arithmetic_or_not <CodeA, -1, A, B> {
- typedef typename non_numeric_types<A, B>::type type;
-};
-
-
-
-
-// PHASE 3 : Are the types same?
-// No, check if they are arithmetic or not
-template <class A, class B>
-struct same_or_not {
- typedef typename detail::remove_reference_and_cv<A>::type plainA;
- typedef typename detail::remove_reference_and_cv<B>::type plainB;
-
- typedef typename
- arithmetic_or_not<
- detail::promote_code<plainA>::value,
- detail::promote_code<plainB>::value,
- A,
- B>::type type;
-};
-// Yes, clear.
-template <class A> struct same_or_not<A, A> {
- typedef A type;
-};
-
-} // detail
-
-// PHASE 2 : Perform first the potential array_to_pointer conversion
-template<class A, class B>
-struct return_type_2<other_action<ifthenelsereturn_action>, A, B> {
-
- typedef typename detail::array_to_pointer<A>::type A1;
- typedef typename detail::array_to_pointer<B>::type B1;
-
- typedef typename
- boost::add_const<typename detail::same_or_not<A1, B1>::type>::type type;
-};
-
-// PHASE 1 : Deduction is based on the second and third operand
-
-
-// return type specialization for conditional expression ends -----------
-
-
-
-
-// Control loop lambda_functor_base specializations.
-
-// Specialization for for_loop.
-template<class Args>
-class
-lambda_functor_base<forloop_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS))
-
- detail::select(boost::tuples::get<3>(args), CALL_ACTUAL_ARGS);
- }
-};
-
-// No body case
-template<class Args>
-class
-lambda_functor_base<forloop_no_body_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS)) {}
- }
-};
-
-
-// Specialization for while_loop.
-template<class Args>
-class
-lambda_functor_base<whileloop_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
-
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- }
-};
-
-// No body case
-template<class Args>
-class
-lambda_functor_base<whileloop_no_body_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) {}
- }
-};
-
-// Specialization for do_while_loop.
-// Note that the first argument is the condition.
-template<class Args>
-class
-lambda_functor_base<dowhileloop_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- do {
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- } while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
- }
-};
-
-// No body case
-template<class Args>
-class
-lambda_functor_base<dowhileloop_no_body_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- do {} while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
- }
-};
-
-
-// Specialization for if_then.
-template<class Args>
-class
-lambda_functor_base<ifthen_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- }
-};
-
-// Specialization for if_then_else.
-template<class Args>
-class
-lambda_functor_base<ifthenelse_action, Args> {
-public:
- Args args;
- template <class T> struct sig { typedef void type; };
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
- else
- detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
- }
-};
-
-// Specialization of lambda_functor_base for if_then_else_return.
-template<class Args>
-class
-lambda_functor_base<other_action<ifthenelsereturn_action>, Args> {
-public:
- Args args;
-
- template <class SigArgs> struct sig {
- private:
- typedef typename detail::nth_return_type_sig<1, Args, SigArgs>::type ret1;
- typedef typename detail::nth_return_type_sig<2, Args, SigArgs>::type ret2;
- public:
- typedef typename return_type_2<
- other_action<ifthenelsereturn_action>, ret1, ret2
- >::type type;
- };
-
-public:
- explicit lambda_functor_base(const Args& a) : args(a) {}
-
- template<class RET, CALL_TEMPLATE_ARGS>
- RET call(CALL_FORMAL_ARGS) const {
- return (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) ?
- detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)
- :
- detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
- }
-};
-
-} // lambda
-} // boost
-
-#endif // BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP

Modified: branches/release/boost/lambda/detail/function_adaptors.hpp
==============================================================================
--- branches/release/boost/lambda/detail/function_adaptors.hpp (original)
+++ branches/release/boost/lambda/detail/function_adaptors.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -12,25 +12,167 @@
 #ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
 #define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
 
+#include "boost/mpl/has_xxx.hpp"
+#include "boost/tuple/tuple.hpp"
 #include "boost/type_traits/same_traits.hpp"
+#include "boost/type_traits/remove_reference.hpp"
+#include "boost/utility/result_of.hpp"
 
 namespace boost {
 namespace lambda {
 
+namespace detail {
+
+BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(has_template_sig, sig, 1, true)
+
+template<class Tuple>
+struct remove_references_from_elements {
+ typedef typename boost::tuples::cons<
+ typename boost::remove_reference<typename Tuple::head_type>::type,
+ typename remove_references_from_elements<typename Tuple::tail_type>::type
+ > type;
+};
+
+template<>
+struct remove_references_from_elements<boost::tuples::null_type> {
+ typedef boost::tuples::null_type type;
+};
+
+}
+
 template <class Func> struct function_adaptor {
 
+ typedef typename detail::remove_reference_and_cv<Func>::type plainF;
+
+#if !defined(BOOST_NO_RESULT_OF)
+ // Support functors that use the boost::result_of return type convention.
+ template<class Tuple, int Length, bool HasSig>
+ struct result_converter;
+ template<class Tuple, int Length>
+ struct result_converter<Tuple, Length, true>
+ : plainF::template sig<
+ typename detail::remove_references_from_elements<Tuple>::type
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 0, false>
+ : result_of<plainF()>
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 1, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 2, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 3, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 4, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 5, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type,
+ typename tuples::element<5, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 6, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type,
+ typename tuples::element<5, Tuple>::type,
+ typename tuples::element<6, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 7, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type,
+ typename tuples::element<5, Tuple>::type,
+ typename tuples::element<6, Tuple>::type,
+ typename tuples::element<7, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 8, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type,
+ typename tuples::element<5, Tuple>::type,
+ typename tuples::element<6, Tuple>::type,
+ typename tuples::element<7, Tuple>::type,
+ typename tuples::element<8, Tuple>::type)
+ >
+ {};
+ template<class Tuple>
+ struct result_converter<Tuple, 9, false>
+ : result_of<plainF(
+ typename tuples::element<1, Tuple>::type,
+ typename tuples::element<2, Tuple>::type,
+ typename tuples::element<3, Tuple>::type,
+ typename tuples::element<4, Tuple>::type,
+ typename tuples::element<5, Tuple>::type,
+ typename tuples::element<6, Tuple>::type,
+ typename tuples::element<7, Tuple>::type,
+ typename tuples::element<8, Tuple>::type,
+ typename tuples::element<9, Tuple>::type)
+ >
+ {};
+
   // we do not know the return type off-hand, we must ask it from Func
- template <class Args> class sig {
- typedef typename Args::head_type F;
+ // To sig we pass a cons list, where the head is the function object type
+ // itself (potentially cv-qualified)
+ // and the tail contains the types of the actual arguments to be passed
+ // to the function object. The arguments can be cv qualified
+ // as well.
+ template <class Args>
+ struct sig
+ : result_converter<
+ Args
+ , tuples::length<typename Args::tail_type>::value
+ , detail::has_template_sig<plainF, Args>::value
+ >
+ {};
+#else // BOOST_NO_RESULT_OF
+
+ template <class Args> class sig {
     typedef typename detail::remove_reference_and_cv<Func>::type plainF;
   public:
- // To sig we pass a cons list, where the head is the function object type
- // itself (potentially cv-qualified)
- // and the tail contains the types of the actual arguments to be passed
- // to the function object. The arguments can be cv qualified
- // as well.
- typedef typename plainF::template sig<Args>::type type;
+ typedef typename plainF::template sig<
+ typename detail::remove_references_from_elements<Args>::type
+ >::type type;
   };
+#endif
 
   template<class RET, class A1>
   static RET apply(A1& a1) {

Modified: branches/release/boost/lambda/detail/lambda_functor_base.hpp
==============================================================================
--- branches/release/boost/lambda/detail/lambda_functor_base.hpp (original)
+++ branches/release/boost/lambda/detail/lambda_functor_base.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -13,6 +13,12 @@
 #ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
 #define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
 
+#include "boost/type_traits/add_reference.hpp"
+#include "boost/type_traits/add_const.hpp"
+#include "boost/type_traits/remove_const.hpp"
+#include "boost/lambda/detail/lambda_fwd.hpp"
+#include "boost/lambda/detail/lambda_traits.hpp"
+
 namespace boost {
 namespace lambda {
 
@@ -40,7 +46,7 @@
   explicit identity(par_t t) : elem(t) {}
 
   template <typename SigArgs>
- struct sig { typedef element_t type; };
+ struct sig { typedef typename boost::remove_const<element_t>::type type; };
 
   template<class RET, CALL_TEMPLATE_ARGS>
   RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
@@ -377,7 +383,7 @@
                                                                        \
   template<class SigArgs> struct sig { \
     typedef typename \
- detail::deduce_non_ref_argument_types<Args, SigArgs>::type rets_t; \
+ detail::deduce_argument_types<Args, SigArgs>::type rets_t; \
   public: \
     typedef typename \
       return_type_N_prot<Act, rets_t>::type type; \

Modified: branches/release/boost/lambda/detail/lambda_functors.hpp
==============================================================================
--- branches/release/boost/lambda/detail/lambda_functors.hpp (original)
+++ branches/release/boost/lambda/detail/lambda_functors.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -161,6 +161,25 @@
     inherited::template sig<null_type>::type
       nullary_return_type;
 
+ // Support for boost::result_of.
+ template <class Sig> struct result;
+ template <class F>
+ struct result<F()> {
+ typedef nullary_return_type type;
+ };
+ template <class F, class A>
+ struct result<F(A)> {
+ typedef typename sig<tuple<F, A> >::type type;
+ };
+ template <class F, class A, class B>
+ struct result<F(A, B)> {
+ typedef typename sig<tuple<F, A, B> >::type type;
+ };
+ template <class F, class A, class B, class C>
+ struct result<F(A, B, C)> {
+ typedef typename sig<tuple<F, A, B, C> >::type type;
+ };
+
   nullary_return_type operator()() const {
     return inherited::template
       call<nullary_return_type>

Modified: branches/release/boost/lambda/detail/lambda_traits.hpp
==============================================================================
--- branches/release/boost/lambda/detail/lambda_traits.hpp (original)
+++ branches/release/boost/lambda/detail/lambda_traits.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -16,6 +16,7 @@
 #include "boost/type_traits/cv_traits.hpp"
 #include "boost/type_traits/function_traits.hpp"
 #include "boost/type_traits/object_traits.hpp"
+#include "boost/tuple/tuple.hpp"
 
 namespace boost {
 namespace lambda {

Modified: branches/release/boost/lambda/detail/operators.hpp
==============================================================================
--- branches/release/boost/lambda/detail/operators.hpp (original)
+++ branches/release/boost/lambda/detail/operators.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -37,16 +37,16 @@
 lambda_functor< \
   lambda_functor_base< \
     ACTION, \
- tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type> \
+ tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type> \
> \
> \
 OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) { \
   return \
     lambda_functor_base< \
       ACTION, \
- tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type> \
+ tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>\
> \
- (tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>(a, b)); \
+ (tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \
 }
 
 

Modified: branches/release/boost/lambda/detail/return_type_traits.hpp
==============================================================================
--- branches/release/boost/lambda/detail/return_type_traits.hpp (original)
+++ branches/release/boost/lambda/detail/return_type_traits.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -216,8 +216,6 @@
 
 
   // currently there are no protectable actions with > 2 args
- // Note, that if there will be, lambda_functor_base will have to be
- // changed to not get rid of references in Args elements
 
 template<class Act, class Args> struct return_type_N_prot {
   typedef typename return_type_N<Act, Args>::type type;

Modified: branches/release/boost/lambda/exceptions.hpp
==============================================================================
--- branches/release/boost/lambda/exceptions.hpp (original)
+++ branches/release/boost/lambda/exceptions.hpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -14,6 +14,7 @@
 #if !defined(BOOST_LAMBDA_EXCEPTIONS_HPP)
 #define BOOST_LAMBDA_EXCEPTIONS_HPP
 
+#include "boost/lambda/core.hpp"
 #include "boost/lambda/detail/control_constructs_common.hpp"
 
 namespace boost {

Modified: branches/release/libs/lambda/test/Jamfile
==============================================================================
--- branches/release/libs/lambda/test/Jamfile (original)
+++ branches/release/libs/lambda/test/Jamfile 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -30,5 +30,6 @@
     [ run operator_tests_simple.cpp ]
     [ run phoenix_control_structures.cpp ]
     [ run switch_construct.cpp ]
+ [ run result_of_tests.cpp ]
     [ run ret_test.cpp ]
   ;

Modified: branches/release/libs/lambda/test/bind_tests_advanced.cpp
==============================================================================
--- branches/release/libs/lambda/test/bind_tests_advanced.cpp (original)
+++ branches/release/libs/lambda/test/bind_tests_advanced.cpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -2,6 +2,7 @@
 //
 // Copyright (C) 2000-2003 Jaakko Jarvi (jaakko.jarvi_at_[hidden])
 // Copyright (C) 2000-2003 Gary Powell (powellg_at_[hidden])
+// Copyright (C) 2010 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -19,6 +20,9 @@
 
 
 #include "boost/any.hpp"
+#include "boost/type_traits/is_reference.hpp"
+#include "boost/mpl/assert.hpp"
+#include "boost/mpl/if.hpp"
 
 #include <iostream>
 
@@ -352,6 +356,55 @@
   BOOST_CHECK(i == 3);
 }
 
+template<class T>
+struct func {
+ template<class Args>
+ struct sig {
+ typedef typename boost::tuples::element<1, Args>::type arg1;
+ // If the argument type is not the same as the expected type,
+ // return void, which will cause an error. Note that we
+ // can't just assert that the types are the same, because
+ // both const and non-const versions can be instantiated
+ // even though only one is ultimately used.
+ typedef typename boost::mpl::if_<boost::is_same<arg1, T>,
+ typename boost::remove_const<arg1>::type,
+ void
+ >::type type;
+ };
+ template<class U>
+ U operator()(const U& arg) const {
+ return arg;
+ }
+};
+
+void test_sig()
+{
+ int i = 1;
+ BOOST_CHECK(bind(func<int>(), 1)() == 1);
+ BOOST_CHECK(bind(func<const int>(), _1)(static_cast<const int&>(i)) == 1);
+ BOOST_CHECK(bind(func<int>(), _1)(i) == 1);
+}
+
+class base {
+public:
+ virtual int foo() = 0;
+};
+
+class derived : public base {
+public:
+ virtual int foo() {
+ return 1;
+ }
+};
+
+void test_abstract()
+{
+ derived d;
+ base& b = d;
+ BOOST_CHECK(bind(&base::foo, var(b))() == 1);
+ BOOST_CHECK(bind(&base::foo, *_1)(&b) == 1);
+}
+
 int test_main(int, char *[]) {
 
   test_nested_binds();
@@ -361,17 +414,7 @@
   test_const_parameters();
   test_rvalue_arguments();
   test_break_const();
+ test_sig();
+ test_abstract();
   return 0;
 }
-
-
-
-
-
-
-
-
-
-
-
-

Modified: branches/release/libs/lambda/test/cast_test.cpp
==============================================================================
--- branches/release/libs/lambda/test/cast_test.cpp (original)
+++ branches/release/libs/lambda/test/cast_test.cpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -29,7 +29,7 @@
 public:
   virtual std::string class_name() const { return "const base"; }
   virtual std::string class_name() { return "base"; }
-
+ virtual ~base() {}
 };
 
 class derived : public base {

Modified: branches/release/libs/lambda/test/operator_tests_simple.cpp
==============================================================================
--- branches/release/libs/lambda/test/operator_tests_simple.cpp (original)
+++ branches/release/libs/lambda/test/operator_tests_simple.cpp 2010-07-03 15:05:15 EDT (Sat, 03 Jul 2010)
@@ -235,6 +235,22 @@
   (_1 %= 2)(i);
   BOOST_CHECK(i == 1);
   
+ // lambda expression as a left operand with rvalue on RHS
+ (_1 += (0 + 1))(i);
+ BOOST_CHECK(i == 2);
+
+ (_1 -= (0 + 1))(i);
+ BOOST_CHECK(i == 1);
+
+ (_1 *= (0 + 10))(i);
+ BOOST_CHECK(i == 10);
+
+ (_1 /= (0 + 2))(i);
+ BOOST_CHECK(i == 5);
+
+ (_1 %= (0 + 2))(i);
+ BOOST_CHECK(i == 1);
+
   // shifts
   unsigned int ui = 2;
   (_1 <<= 1)(ui);


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