mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-02 15:20:57 +02:00
fixing defective test case with bad rvalue / lvalue handling issue
[SVN r37819]
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
|
||||
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)
|
||||
@ -11,6 +12,24 @@
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
struct search_for
|
||||
{
|
||||
explicit search_for(int search)
|
||||
: search(search)
|
||||
{}
|
||||
|
||||
template<typename T>
|
||||
bool operator()(T const& v) const
|
||||
{
|
||||
return v == search;
|
||||
}
|
||||
|
||||
int search;
|
||||
};
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -27,9 +46,11 @@ main()
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::mpl::vector_c<int, 1, 2, 3> mpl_vec;
|
||||
BOOST_TEST(boost::fusion::all(mpl_vec(), boost::lambda::_1 < 4));
|
||||
BOOST_TEST(!boost::fusion::all(mpl_vec(), boost::lambda::_1 == 2));
|
||||
typedef boost::mpl::vector_c<int, 1> mpl_vec;
|
||||
// We cannot use lambda here as mpl vec iterators return
|
||||
// rvalues, and lambda needs lvalues.
|
||||
BOOST_TEST(boost::fusion::all(mpl_vec(), search_for(1)));
|
||||
BOOST_TEST(!boost::fusion::all(mpl_vec(), search_for(2)));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
Reference in New Issue
Block a user