]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/functional/overloaded_function/test/functor.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / functional / overloaded_function / test / functor.cpp
1
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/functional/overloaded_function
7
8 #include "identity.hpp"
9 #include <boost/functional/overloaded_function.hpp>
10 #include <boost/detail/lightweight_test.hpp>
11
12 int main() {
13 //[identity_calls
14 BOOST_TEST(identity_s("abc") == "abc");
15 BOOST_TEST(identity_i(123) == 123);
16 BOOST_TEST(identity_d(1.23) == 1.23);
17 //]
18
19 //[identity_functor
20 boost::overloaded_function<
21 const std::string& (const std::string&)
22 , int (int)
23 , double (double)
24 > identity(identity_s, identity_i, identity_d);
25
26 // All calls via single `identity` function.
27 BOOST_TEST(identity("abc") == "abc");
28 BOOST_TEST(identity(123) == 123);
29 BOOST_TEST(identity(1.23) == 1.23);
30 //]
31
32 return boost::report_errors();
33 }
34