1 | // (C) Copyright Edward Diener 2020 |
2 | // Use, modification and distribution are subject to the Boost Software License, |
3 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
4 | // http://www.boost.org/LICENSE_1_0.txt). |
5 | |
6 | #include <boost/tti/detail/dmacro_sunfix.hpp> |
7 | |
8 | struct AType |
9 | { |
10 | template<class X,class Y,class Z> double SomeFuncTemplateName(X,Y *,Z &) { return 0.0; } |
11 | template<class X,class Y,short AA> static int StatFuncTemplate(X *,Y) { int ret(AA); return ret; } |
12 | }; |
13 | |
14 | template |
15 | < |
16 | class C, |
17 | class T |
18 | > |
19 | struct TestFunctionTemplate |
20 | { |
21 | typedef char Bad; |
22 | struct Good { char x[2]; }; |
23 | template<T> struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; |
24 | template<class U> static Good check(helper<&U::template SomeFuncTemplateName<int,long,double> > *); |
25 | template<class U> static Bad check(...); |
26 | static const bool value=sizeof(check<C>(0))==sizeof(Good); |
27 | }; |
28 | |
29 | template |
30 | < |
31 | class C, |
32 | class T |
33 | > |
34 | struct TestStaticFunctionTemplate |
35 | { |
36 | typedef char Bad; |
37 | struct Good { char x[2]; }; |
38 | template<T *> struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; |
39 | template<class U> static Good check(helper<&U::template StatFuncTemplate<long,int,1234> > *); |
40 | template<class U> static Bad check(...); |
41 | static const bool value=sizeof(check<C>(0))==sizeof(Good); |
42 | }; |
43 | |
44 | int main() |
45 | { |
46 | |
47 | bool bv = |
48 | |
49 | TestFunctionTemplate |
50 | < |
51 | AType, |
52 | double (AType::*) (int,long *,double &) |
53 | >::value |
54 | |
55 | && |
56 | |
57 | TestStaticFunctionTemplate |
58 | < |
59 | AType, |
60 | int (long *,int) |
61 | >::value |
62 | ; |
63 | |
64 | return (bv ? 0 : 1); |
65 | } |
66 | |