fixing defective test case with bad rvalue / lvalue handling issue

[SVN r37819]
This commit is contained in:
Dan Marsden
2007-05-30 06:47:39 +00:00
parent 6097406ca1
commit da31732ca3
3 changed files with 70 additions and 7 deletions

View File

@ -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();