Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/tr1/test/test_mem_fn.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.0 KB
Line 
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#define NO_INHERT_TEST
15#include "verify_functor.hpp"
16
17struct expected_result
18{
19   expected_result(){}
20};
21
22struct test
23{
24   expected_result field;
25   expected_result nullary();
26   expected_result nullary_c()const;
27   expected_result nullary_v()volatile;
28   expected_result nullary_cv()const volatile;
29   expected_result unary(int);
30   expected_result unary_c(int)const;
31   expected_result unary_v(int)volatile;
32   expected_result unary_cv(int)const volatile;
33};
34
35int main()
36{
37   verify_field_functor(std::tr1::mem_fn(&test::field), std::unary_function<test const*, const expected_result&>());
38   verify_field_functor(std::tr1::mem_fn(&test::field), std::unary_function<test*, expected_result&>());
39   verify_unary_functor(std::tr1::mem_fn(&test::nullary), std::unary_function<test*, expected_result>());
40   verify_unary_functor(std::tr1::mem_fn(&test::nullary_c), std::unary_function<test const*, expected_result>());
41   //verify_unary_functor(std::tr1::mem_fn(&test::nullary_v), std::unary_function<test volatile*, expected_result>());
42   //verify_unary_functor(std::tr1::mem_fn(&test::nullary_cv), std::unary_function<test const volatile*, expected_result>());
43
44   verify_binary_functor(std::tr1::mem_fn(&test::unary), std::binary_function<test*, int, expected_result>());
45   verify_binary_functor(std::tr1::mem_fn(&test::unary_c), std::binary_function<test const*, int, expected_result>());
46   //verify_binary_functor(std::tr1::mem_fn(&test::unary_v), std::binary_function<test volatile*, int, expected_result>());
47   //verify_binary_functor(std::tr1::mem_fn(&test::unary_cv), std::binary_function<test const volatile*, int, expected_result>());
48   return 0;
49}
50
Note: See TracBrowser for help on using the repository browser.