mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added support for C++11 lambdas as constraints
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@620 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
c5861a744d
commit
4afe1d32d4
6 changed files with 77 additions and 10 deletions
|
|
@ -261,4 +261,10 @@ This is actually a bug in the compiler, for more information see [@http://connec
|
|||
|
||||
[endsect]
|
||||
|
||||
[section Using C++11 lambda as constraints requires decltype compiler support]
|
||||
|
||||
The technique used in order to detect whether a constraint is a C++11 lambda or not is based on decltype, which means the library can fail to detect a lambda in case the compiler does not support it.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
|
|
|||
|
|
@ -590,6 +590,14 @@ Example using [@http://www.boost.org/libs/phoenix Boost.Phoenix] :
|
|||
MOCK_EXPECT( c.method ).with( boost::phoenix::arg_names::_1 == 42 );
|
||||
}
|
||||
|
||||
Example using C++11 lambdas :
|
||||
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_adding_a_constraint_with_cxx11_lambda )
|
||||
{
|
||||
mock_class c;
|
||||
MOCK_EXPECT( c.method ).with( []( int actual ) { return 42 == actual; } );
|
||||
}
|
||||
|
||||
Example using &&, || and ! :
|
||||
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_combining_constraints )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue