]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright John Maddock 2005. |
2 | // Use, modification and distribution are subject to the | |
3 | // Boost Software License, Version 1.0. (See accompanying file | |
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #ifdef TEST_STD_HEADERS | |
7 | #include <functional> | |
8 | #else | |
9 | #include <boost/tr1/functional.hpp> | |
10 | #endif | |
11 | ||
12 | #include <boost/static_assert.hpp> | |
13 | #include <boost/type_traits/is_same.hpp> | |
14 | #include "verify_functor.hpp" | |
15 | ||
16 | struct expected_result{}; | |
17 | ||
18 | struct test | |
19 | { | |
20 | expected_result field; | |
21 | expected_result nullary(); | |
22 | expected_result nullary_c()const; | |
23 | expected_result nullary_v()volatile; | |
24 | expected_result nullary_cv()const volatile; | |
25 | expected_result unary(int); | |
26 | expected_result unary_c(int)const; | |
27 | expected_result unary_v(int)volatile; | |
28 | expected_result unary_cv(int)const volatile; | |
29 | }; | |
30 | ||
31 | int main() | |
32 | { | |
33 | verify_field_functor(std::tr1::mem_fn(&test::field), std::unary_function<test const*, const expected_result&>()); | |
34 | verify_field_functor(std::tr1::mem_fn(&test::field), std::unary_function<test*, expected_result&>()); | |
35 | verify_unary_functor(std::tr1::mem_fn(&test::nullary), std::unary_function<test*, expected_result>()); | |
36 | verify_unary_functor(std::tr1::mem_fn(&test::nullary_c), std::unary_function<test const*, expected_result>()); | |
37 | verify_unary_functor(std::tr1::mem_fn(&test::nullary_v), std::unary_function<test volatile*, expected_result>()); | |
38 | verify_unary_functor(std::tr1::mem_fn(&test::nullary_cv), std::unary_function<test const volatile*, expected_result>()); | |
39 | ||
40 | verify_binary_functor(std::tr1::mem_fn(&test::unary), std::binary_function<test*, int, expected_result>()); | |
41 | verify_binary_functor(std::tr1::mem_fn(&test::unary_c), std::binary_function<test const*, int, expected_result>()); | |
42 | verify_binary_functor(std::tr1::mem_fn(&test::unary_v), std::binary_function<test volatile*, int, expected_result>()); | |
43 | verify_binary_functor(std::tr1::mem_fn(&test::unary_cv), std::binary_function<test const volatile*, int, expected_result>()); | |
44 | return 0; | |
45 | } | |
46 |