Skip to content

Commit 72b8703

Browse files
committed
BOOST_OPENMETHOD_DETAIL_HAS_STATIC_FN
1 parent 5262944 commit 72b8703

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/boost/openmethod/preamble.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <boost/mp11/algorithm.hpp>
77
#include <boost/mp11/bind.hpp>
8+
#include <boost/preprocessor/cat.hpp>
89

910
#include <stdlib.h>
1011
#include <vector>
@@ -869,6 +870,17 @@ struct initialize_aux;
869870

870871
} // namespace detail
871872

873+
#define BOOST_OPENMETHOD_DETAIL_HAS_STATIC_FN(FN) \
874+
template<typename, class, class...> \
875+
struct BOOST_PP_CAT(has_, BOOST_PP_CAT(FN, _aux)) : std::false_type {}; \
876+
template<class T, class... Args> \
877+
struct BOOST_PP_CAT(has_, BOOST_PP_CAT(FN, _aux))< \
878+
std::void_t<decltype(T::FN(std::declval<Args>()...))>, T, Args...> \
879+
: std::true_type {}; \
880+
template<class T, class... Args> \
881+
constexpr bool BOOST_PP_CAT(has_, FN) = \
882+
BOOST_PP_CAT(has_, BOOST_PP_CAT(FN, _aux))<void, T, Args...>::value
883+
872884
//! Methods, classes and policies.
873885
//!
874886
//! Methods exist in the context of a registry. Any class used as a method or

0 commit comments

Comments
 (0)