|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53875 - in branches/release: boost/lambda/detail libs/lambda/doc libs/lambda/test
From: steven_at_[hidden]
Date: 2009-06-13 17:18:12
Author: steven_watanabe
Date: 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
New Revision: 53875
URL: http://svn.boost.org/trac/boost/changeset/53875
Log:
Merge [43113], [45097], [53261], [53343], [53648], [53649], and [53651] from the trunk
Added:
branches/release/libs/lambda/test/ret_test.cpp
- copied unchanged from r53648, /trunk/libs/lambda/test/ret_test.cpp
Text files modified:
branches/release/boost/lambda/detail/lambda_functor_base.hpp | 2 +
branches/release/boost/lambda/detail/lambda_functors.hpp | 34 ++++++++++++++++--
branches/release/boost/lambda/detail/operator_return_type_traits.hpp | 71 ++-------------------------------------
branches/release/libs/lambda/doc/lambda.xml | 6 +-
branches/release/libs/lambda/test/Jamfile | 1
branches/release/libs/lambda/test/operator_tests_simple.cpp | 12 ++++++
6 files changed, 51 insertions(+), 75 deletions(-)
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 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -270,6 +270,8 @@
public:
Args args;
+ typedef RET result_type;
+
explicit lambda_functor_base(const Args& a) : args(a) {}
template <class SigArgs> struct sig { typedef RET 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 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -13,6 +13,30 @@
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+
+#include <boost/mpl/or.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_array.hpp>
+
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1)\
+ typename lazy_disable_if<is_array<A1>, typename R1 >::type
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) \
+ typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2> >, typename R1, R2 >::type
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) \
+ typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2>, is_array<A3> >, typename R1, R2, R3 >::type
+
+#else
+
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1) typename R1::type
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) typename R1, R2::type
+#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) typename R1, R2, R3::type
+
+#endif
+
namespace boost {
namespace lambda {
@@ -152,7 +176,7 @@
}
template<class A>
- typename inherited::template sig<tuple<A const&> >::type
+ BOOST_LAMBDA_DISABLE_IF_ARRAY1(A, inherited::template sig<tuple<A const&> >)
operator()(A const& a) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&> >::type
@@ -168,7 +192,7 @@
}
template<class A, class B>
- typename inherited::template sig<tuple<A const&, B&> >::type
+ BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B&> >)
operator()(A const& a, B& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B&> >::type
@@ -176,7 +200,7 @@
}
template<class A, class B>
- typename inherited::template sig<tuple<A&, B const&> >::type
+ BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A&, B const&> >)
operator()(A& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A&, B const&> >::type
@@ -184,7 +208,7 @@
}
template<class A, class B>
- typename inherited::template sig<tuple<A const&, B const&> >::type
+ BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B const&> >)
operator()(A const& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B const&> >::type
@@ -201,7 +225,7 @@
}
template<class A, class B, class C>
- typename inherited::template sig<tuple<A const&, B const&, C const&> >::type
+ BOOST_LAMBDA_DISABLE_IF_ARRAY3(A, B, C, inherited::template sig<tuple<A const&, B const&, C const&> >)
operator()(A const& a, B const& b, C const& c) const
{
return inherited::template call<
Modified: branches/release/boost/lambda/detail/operator_return_type_traits.hpp
==============================================================================
--- branches/release/boost/lambda/detail/operator_return_type_traits.hpp (original)
+++ branches/release/boost/lambda/detail/operator_return_type_traits.hpp 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -15,6 +15,7 @@
#include "boost/type_traits/same_traits.hpp"
#include "boost/indirect_reference.hpp"
+#include "boost/detail/container_fwd.hpp"
#include <cstddef> // needed for the ptrdiff_t
#include <iosfwd> // for istream and ostream
@@ -58,10 +59,6 @@
} // namespace lambda
} // namespace boost
-namespace std {
- template<class T> class complex;
-}
-
namespace boost {
namespace lambda {
namespace detail {
@@ -228,37 +225,15 @@
template <class A> struct contentsof_type<const A> {
- typedef typename contentsof_type<A>::type type1;
- // return a reference to the underlying const type
- // the IF is because the A::reference in the primary template could
- // be some class type rather than a real reference, hence
- // we do not want to make it a reference here either
- typedef typename boost::remove_reference<type1>::type no_reference;
- typedef typename detail::IF<
- is_reference<type1>::value,
- const no_reference &,
- const no_reference
- >::RET type;
+ typedef typename contentsof_type<A>::type type;
};
template <class A> struct contentsof_type<volatile A> {
- typedef typename contentsof_type<A>::type type1;
- typedef typename boost::remove_reference<type1>::type no_reference;
- typedef typename detail::IF<
- is_reference<type1>::value,
- volatile no_reference &,
- volatile no_reference
- >::RET type;
+ typedef typename contentsof_type<A>::type type;
};
template <class A> struct contentsof_type<const volatile A> {
- typedef typename contentsof_type<A>::type type1;
- typedef typename boost::remove_reference<type1>::type no_reference;
- typedef typename detail::IF<
- is_reference<type1>::value,
- const volatile no_reference &,
- const volatile no_reference
- >::RET type;
+ typedef typename contentsof_type<A>::type type;
};
// standard iterator traits should take care of the pointer types
@@ -856,44 +831,6 @@
};
-
-} // namespace lambda
-} // namespace boost
-
-
-// Forward declarations are incompatible with the libstdc++ debug mode.
-#if BOOST_WORKAROUND(__GNUC__, >= 3) && defined(_GLIBCXX_DEBUG)
-#include <string>
-#include <vector>
-#include <map>
-#include <deque>
-#else
-
-// The GCC 2.95.x uses a non-conformant deque
-#if BOOST_WORKAROUND(__GNUC__, == 2) && __GNUC_MINOR__ <= 96
-#include <deque>
-#else
-
-namespace std {
- template <class T, class Allocator> class deque;
-}
-
-#endif
-
-namespace std {
- template <class Char, class Traits, class Allocator> class basic_string;
- template <class T, class Allocator> class vector;
- template <class Key, class T, class Cmp, class Allocator> class map;
- template <class Key, class T, class Cmp, class Allocator> class multimap;
-}
-
-#endif
-
-
-
-namespace boost {
-namespace lambda {
-
template<class Key, class T, class Cmp, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::map<Key, T, Cmp, Allocator>, B> {
typedef T& type;
Modified: branches/release/libs/lambda/doc/lambda.xml
==============================================================================
--- branches/release/libs/lambda/doc/lambda.xml (original)
+++ branches/release/libs/lambda/doc/lambda.xml 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -44,7 +44,7 @@
<para>
The Boost Lambda Library (BLL in the sequel) is a C++ template
- library, which implements form of <emphasis>lambda abstractions</emphasis> for C++.
+ library, which implements a form of <emphasis>lambda abstractions</emphasis> for C++.
The term originates from functional programming and lambda calculus, where a lambda abstraction defines an unnamed function.
The primary motivation for the BLL is to provide flexible and
convenient means to define unnamed function objects for STL algorithms.
@@ -3191,7 +3191,7 @@
-<appendix>
+<section>
<title>Rationale for some of the design decisions</title>
<section id="lambda.why_weak_arity">
@@ -3256,7 +3256,7 @@
</section>
-</appendix>
+</section>
Modified: branches/release/libs/lambda/test/Jamfile
==============================================================================
--- branches/release/libs/lambda/test/Jamfile (original)
+++ branches/release/libs/lambda/test/Jamfile 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -30,4 +30,5 @@
[ run operator_tests_simple.cpp ]
[ run phoenix_control_structures.cpp ]
[ run switch_construct.cpp ]
+ [ run ret_test.cpp ]
;
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 2009-06-13 17:18:10 EDT (Sat, 13 Jun 2009)
@@ -19,6 +19,8 @@
#include "boost/lambda/detail/suppress_unused.hpp"
+#include <boost/shared_ptr.hpp>
+
#include <vector>
#include <map>
#include <set>
@@ -323,8 +325,18 @@
(*_1 = 7)(it);
BOOST_CHECK(vi[0] == 7);
+ const std::vector<int>::iterator cit(it);
+ (*_1 = 8)(cit);
+ BOOST_CHECK(vi[0] == 8);
// TODO: Add tests for more complex iterator types
+
+ boost::shared_ptr<int> ptr(new int(0));
+ (*_1 = 7)(ptr);
+ BOOST_CHECK(*ptr == 7);
+ const boost::shared_ptr<int> cptr(ptr);
+ (*_1 = 8)(cptr);
+ BOOST_CHECK(*ptr == 8);
}
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