1
2// (C) Copyright Edward Diener 2011,2012,2013
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6
7#if !defined(BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_HPP)
8#define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_HPP
9
10#include <boost/config.hpp>
11#include <boost/function_types/property_tags.hpp>
12#include <boost/mpl/vector.hpp>
13#include <boost/preprocessor/cat.hpp>
14#include <boost/tti/detail/dstatic_mem_fun.hpp>
15#include <boost/tti/gen/has_static_member_function_gen.hpp>
16
17/*
18
19 The succeeding comments in this file are in doxygen format.
20
21*/
22
23/** \file
24*/
25
26/// Expands to a metafunction which tests whether a static member function with a particular name and signature exists.
27/**
28
29 trait = the name of the metafunction within the tti namespace.
30
31 name = the name of the inner member.
32
33 generates a metafunction called "trait" where 'trait' is the macro parameter.
34
35 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
36 struct trait
37 {
38 static const value = unspecified;
39 typedef mpl::bool_<true-or-false> type;
40 };
41
42 The metafunction types and return:
43
44 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'.
45
46 BOOST_TTI_TP_R = the return type of the static member function
47 OR
48 the signature of a function in the form of Return_Type ( Parameter_Types )
49
50 BOOST_TTI_TP_FS = (optional) the parameters of the static member function as a boost::mpl forward sequence
51 if the second parameter is a return type and the function parameters exist.
52
53 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function
54 if the second parameter is a return type and the need for a tag exists.
55
56 returns = 'value' is true if the 'name' exists,
57 with the appropriate static member function type,
58 otherwise 'value' is false.
59
60*/
61#define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
62 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
63 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
64 struct trait \
65 { \
66 typedef typename \
67 BOOST_PP_CAT(trait,_detail_hsmf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
68 BOOST_STATIC_CONSTANT(bool,value=type::value); \
69 }; \
70/**/
71
72/// Expands to a metafunction which tests whether a static member function with a particular name and signature exists.
73/**
74
75 name = the name of the inner member.
76
77 generates a metafunction called "has_static_member_function_name" where 'name' is the macro parameter.
78
79 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
80 struct trait
81 {
82 static const value = unspecified;
83 typedef mpl::bool_<true-or-false> type;
84 };
85
86 The metafunction types and return:
87
88 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'.
89
90 BOOST_TTI_TP_R = the return type of the static member function
91 OR
92 the signature of a function in the form of Return_Type ( Parameter_Types )
93
94 BOOST_TTI_TP_FS = (optional) the parameters of the static member function as a boost::mpl forward sequence
95 if the second parameter is a return type and the function parameters exist.
96
97 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function
98 if the second parameter is a return type and the need for a tag exists.
99
100 returns = 'value' is true if the 'name' exists,
101 with the appropriate static member function type,
102 otherwise 'value' is false.
103
104*/
105#define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(name) \
106 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION \
107 ( \
108 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(name), \
109 name \
110 ) \
111/**/
112
113#endif // BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_HPP
114

source code of boost/boost/tti/has_static_member_function.hpp