Force result_of use decltype whenever possible to maximize testing of function input iterator with lambdas.

This commit is contained in:
Andrey Semashev 2017-09-08 18:12:02 +03:00
parent a26314dfb9
commit 379200dfd1

View File

@ -10,6 +10,16 @@
#include <vector>
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_DECLTYPE)
// Force boost::result_of use decltype, even on compilers that don't support N3276.
// This enables this test to also verify if the iterator works with lambdas
// on such compilers with this config macro. Note that without the macro result_of
// (and consequently the iterator) is guaranteed to _not_ work, so this case is not
// worth testing anyway.
#define BOOST_RESULT_OF_USE_DECLTYPE
#endif
#include <boost/core/lightweight_test.hpp>
#include <boost/iterator/function_input_iterator.hpp>
@ -90,7 +100,7 @@ int main()
BOOST_TEST_EQ(generated[i], static_cast<int>(42 + i));
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \
&& (!defined(BOOST_NO_CXX11_DECLTYPE_N3276) || defined(BOOST_RESULT_OF_USE_DECLTYPE))
&& defined(BOOST_RESULT_OF_USE_DECLTYPE)
// test the iterator with lambda expressions
int num = 42;
auto lambda_generator = [&num] { return num++; };