Ticket #9754: sample.cpp

File sample.cpp, 878 bytes (added by Yaroslav Lukyanchuk <yarosladov@…>, 9 years ago)

sample code

Line 
1#include <boost/type_traits/is_function.hpp>
2
3struct CallerConst
4 {
5 void Call() const
6 {
7 }
8 };
9
10struct CallerNonConst
11 {
12 void Call()
13 {
14 }
15 };
16
17struct FunctorNonConst
18 {
19 void operator()()
20 {
21 }
22 };
23
24struct FunctorConst
25 {
26 void operator()() const
27 {
28 }
29 };
30
31void Function()
32 {
33 }
34
35int main()
36 {
37 auto val1 = boost::is_function<void()>::value;
38 auto val2 = boost::is_function<decltype(Function)>::value;
39 auto val3 = boost::is_function<decltype(CallerConst().Call())>::value;
40 auto val4 = boost::is_function<decltype(CallerNonConst().Call())>::value;
41 auto val5 = boost::is_function<decltype(FunctorNonConst().operator())>::value;
42 auto val6 = boost::is_function<decltype(FunctorConst().operator())>::value; // VC++ compile error if any of val1, val2, val5 is present
43
44 return 0;
45 }