mirror of
https://github.com/boostorg/function.git
synced 2025-07-29 20:37:14 +02:00
Support fn.contains(f) where f is a function. Fixes #46.
This commit is contained in:
33
test/contains3_test.cpp
Normal file
33
test/contains3_test.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
static int f()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int g()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::function<int()> fn;
|
||||
BOOST_TEST( !fn.contains( f ) );
|
||||
BOOST_TEST( !fn.contains( g ) );
|
||||
}
|
||||
|
||||
{
|
||||
boost::function<int()> fn( f );
|
||||
BOOST_TEST( fn.contains( f ) );
|
||||
BOOST_TEST( !fn.contains( g ) );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user