2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-21 04:52:25 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Beman Dawes
af6ca9c573 Branch for 2nd try at V2 removal
[SVN r77497]
2012-03-23 12:04:44 +00:00
16 changed files with 88 additions and 73 deletions

View File

@@ -1,4 +1,4 @@
project lambda/doc ;
project boost/doc ;
import boostbook : boostbook ;
# Are these really the correct images??

0
doc/detail/lambda_doc.xml Executable file → Normal file
View File

View File

@@ -22,6 +22,13 @@
# define BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T
# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING
# endif
# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97)
# define BOOST_NO_TEMPLATED_STREAMS
# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING
# endif
# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
# define BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER
# endif
# endif // __GNUC__

View File

@@ -15,7 +15,6 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/utility/result_of.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
@@ -298,38 +297,6 @@ public:
} // namespace lambda
} // namespace boost
namespace boost {
#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_DECLTYPE)
template<class T>
struct result_of<boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
template<class T>
struct result_of<const boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
#endif
template<class T>
struct tr1_result_of<boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
template<class T>
struct tr1_result_of<const boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
}
// is_placeholder
#include <boost/is_placeholder.hpp>

View File

@@ -282,11 +282,6 @@ struct const_copy_argument<void> {
typedef void type;
};
template<>
struct const_copy_argument<void const> {
typedef void type;
};
// Does the same as const_copy_argument, but passes references through as such
template<class T>

View File

@@ -12,13 +12,7 @@
#define BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP
#include "boost/lambda/detail/is_instance_of.hpp"
#include "boost/type_traits/is_same.hpp"
#include "boost/type_traits/is_pointer.hpp"
#include "boost/type_traits/is_float.hpp"
#include "boost/type_traits/is_convertible.hpp"
#include "boost/type_traits/remove_pointer.hpp"
#include "boost/type_traits/remove_const.hpp"
#include "boost/type_traits/remove_reference.hpp"
#include "boost/type_traits/same_traits.hpp"
#include "boost/indirect_reference.hpp"
#include "boost/detail/container_fwd.hpp"
@@ -542,6 +536,36 @@ struct return_type_2<bitwise_action<Act>, A, B>
namespace detail {
#ifdef BOOST_NO_TEMPLATED_STREAMS
template<class A, class B>
struct leftshift_type {
typedef typename detail::IF<
boost::is_convertible<
typename boost::remove_reference<A>::type*,
std::ostream*
>::value,
std::ostream&,
typename detail::remove_reference_and_cv<A>::type
>::RET type;
};
template<class A, class B>
struct rightshift_type {
typedef typename detail::IF<
boost::is_convertible<
typename boost::remove_reference<A>::type*,
std::istream*
>::value,
std::istream&,
typename detail::remove_reference_and_cv<A>::type
>::RET type;
};
#else
template <class T> struct get_ostream_type {
typedef std::basic_ostream<typename T::char_type,
@@ -578,6 +602,7 @@ public:
};
#endif
} // end detail

View File

@@ -161,6 +161,23 @@ namespace detail {
// Note that the overloading is const vs. non-const first argument
#ifdef BOOST_NO_TEMPLATED_STREAMS
template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
boost::is_convertible<T*, std::ostream*>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
boost::is_convertible<T*, std::istream*>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
#else
template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
@@ -181,6 +198,7 @@ template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typename const_copy_argument <T>::type
>::RET type;
};
#endif
} // detail

View File

@@ -284,7 +284,7 @@ inline const
lambda_functor<
lambda_functor_base<do_nothing_action, null_type>
>
make_void(const Arg1&) {
make_void(const Arg1& a1) {
return
lambda_functor_base<do_nothing_action, null_type>();
}

View File

@@ -19,6 +19,10 @@
namespace boost {
namespace lambda {
using ::boost::type_traits::ice_and;
using ::boost::type_traits::ice_or;
using ::boost::type_traits::ice_not;
// Much of the type deduction code for standard arithmetic types
// from Gary Powell
@@ -73,7 +77,8 @@ template <class Act, class A> struct return_type_1_prot {
public:
typedef typename
detail::IF<
is_protectable<Act>::value && is_lambda_functor<A>::value,
// is_protectable<Act>::value && is_lambda_functor<A>::value,
ice_and<is_protectable<Act>::value, is_lambda_functor<A>::value>::value,
lambda_functor<
lambda_functor_base<
Act,
@@ -107,7 +112,9 @@ namespace detail {
// add const to rvalues, so that all rvalues are stored as const in
// the args tuple
typedef typename detail::IF_type<
boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value,
// boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value,
ice_and<boost::is_reference<T>::value,
ice_not<boost::is_const<non_ref_T>::value>::value>::value,
detail::identity_mapping<T>,
const_copy_argument<non_ref_T> // handles funtion and array
>::type type; // types correctly
@@ -141,8 +148,11 @@ template <class Act, class A, class B> struct return_type_2_prot {
typedef typename
detail::IF<
is_protectable<Act>::value &&
(is_lambda_functor<A>::value || is_lambda_functor<B>::value),
// is_protectable<Act>::value &&
// (is_lambda_functor<A>::value || is_lambda_functor<B>::value),
ice_and<is_protectable<Act>::value,
ice_or<is_lambda_functor<A>::value,
is_lambda_functor<B>::value>::value>::value,
lambda_functor<
lambda_functor_base<
Act,
@@ -177,8 +187,11 @@ struct return_type_2_comma
typedef typename
detail::IF<
is_protectable<other_action<comma_action> >::value && // it is protectable
(is_lambda_functor<A>::value || is_lambda_functor<B>::value),
// is_protectable<other_action<comma_action> >::value && // it is protectable
// (is_lambda_functor<A>::value || is_lambda_functor<B>::value),
ice_and<is_protectable<other_action<comma_action> >::value, // it is protectable
ice_or<is_lambda_functor<A>::value,
is_lambda_functor<B>::value>::value>::value,
lambda_functor<
lambda_functor_base<
other_action<comma_action>,

View File

@@ -10,8 +10,8 @@
// ------------------------------------------------------------
#ifndef BOOST_LAMBDA_SUPPRESS_UNUSED_HPP
#define BOOST_LAMBDA_SUPPRESS_UNUSED_HPP
#ifndef BOOST_LAMBDA_SUPRESS_UNUSED_HPP
#define BOOST_LAMBDA_SUPRESS_UNUSED_HPP
namespace boost {
namespace lambda {

View File

@@ -345,7 +345,7 @@ public:
// is true, the true_statement (again an lambda_functor) is executed
// otherwise, the false_statement (another lambda_functor) is executed. The
// result type of this is void. Note the trailing underscore after
// if_ and the leading dot and the trailing underscore before
// if_ and the the leading dot and the trailing underscore before
// and after .else_.
//
///////////////////////////////////////////////////////////////////////////////

View File

@@ -24,6 +24,11 @@
#include "boost/lambda/detail/operators.hpp"
#ifndef BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER
// sorry, member ptr does not work with gcc2.95
#include "boost/lambda/detail/member_ptr.hpp"
#endif
#endif

View File

@@ -348,7 +348,7 @@ while_(CondT const& cond)
// While the condition (an lambda_functor) evaluates to true, statement
// (another lambda_functor) is executed. The statement is executed at least
// once. The result type of this is void. Note the trailing
// underscore after do_ and the leading dot and the trailing
// underscore after do_ and the the leading dot and the trailing
// underscore before and after .while_.
//
///////////////////////////////////////////////////////////////////////////////

View File

@@ -1,15 +0,0 @@
{
"key": "lambda",
"name": "Lambda",
"authors": [
"Jaakko Järvi",
"Gary Powell"
],
"description": "Define small unnamed function objects at the actual call site, and more.",
"category": [
"Function-objects"
],
"maintainers": [
"Jaakko Jarvi <jarvi -at- cs.tamu.edu>"
]
}

0
test/Makefile Executable file → Normal file
View File

View File

@@ -299,7 +299,7 @@ int test_main(int, char *[]) {
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five), var(six), var(seven), var(eight), var(nine))() == 9);
// Check using result_of with lambda functors
BOOST_CHECK(apply0(constant(0)) == 0);
//BOOST_CHECK(apply0(constant(0)) == 0);
BOOST_CHECK(apply1<int>(_1, one) == 1);
BOOST_CHECK(apply1<int&>(_1, one) == 1);
BOOST_CHECK(apply1<const int&>(_1, one) == 1);