1// Copyright Cromwell D. Enage 2019.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
7#define BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
8
9#include <boost/parameter/aux_/yesno.hpp>
10#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
11#include <boost/parameter/config.hpp>
12
13#if defined(BOOST_PARAMETER_CAN_USE_MP11)
14#include <boost/mp11/integral.hpp>
15#include <boost/mp11/utility.hpp>
16#else
17#include <boost/mpl/bool.hpp>
18#include <boost/mpl/identity.hpp>
19#endif
20
21namespace boost { namespace parameter { namespace aux {
22
23#if defined(BOOST_PARAMETER_CAN_USE_MP11)
24 template <template <typename ...> class F>
25 struct has_nested_template_fn_variadic
26 {
27 };
28#else
29 template <template <typename P0, typename P1> class F>
30 struct has_nested_template_fn_arity_2
31 {
32 };
33#endif
34
35 template <typename T>
36 class has_nested_template_fn_impl
37 {
38 template <typename U>
39 static ::boost::parameter::aux::no_tag _check(...);
40
41#if defined(BOOST_PARAMETER_CAN_USE_MP11)
42 template <typename U>
43 static ::boost::parameter::aux::yes_tag
44 _check(
45 ::boost::mp11::mp_identity<U> const volatile*
46 , ::boost::parameter::aux::has_nested_template_fn_variadic<
47 U::template fn
48 >* = BOOST_PARAMETER_AUX_PP_NULLPTR
49 );
50#else
51 template <typename U>
52 static BOOST_CONSTEXPR ::boost::parameter::aux::yes_tag
53 _check(
54 ::boost::mpl::identity<U> const volatile*
55 , ::boost::parameter::aux::has_nested_template_fn_arity_2<
56 U::template fn
57 >* = BOOST_PARAMETER_AUX_PP_NULLPTR
58 );
59#endif
60
61 public:
62#if defined(BOOST_PARAMETER_CAN_USE_MP11)
63 using type = ::boost::mp11::mp_bool<
64#else
65 typedef ::boost::mpl::bool_<
66#endif
67 sizeof(
68 ::boost::parameter::aux::has_nested_template_fn_impl<T>
69 ::template _check<T>(
70 static_cast<
71#if defined(BOOST_PARAMETER_CAN_USE_MP11)
72 ::boost::mp11::mp_identity<T> const volatile*
73#else
74 ::boost::mpl::identity<T> const volatile*
75#endif
76 >(BOOST_PARAMETER_AUX_PP_NULLPTR)
77 )
78 ) == sizeof(::boost::parameter::aux::yes_tag)
79#if defined(BOOST_PARAMETER_CAN_USE_MP11)
80 >;
81#else
82 > type;
83#endif
84 };
85}}} // namespace boost::parameter::aux
86
87#if defined(BOOST_PARAMETER_CAN_USE_MP11)
88#include <type_traits>
89#else
90#include <boost/type_traits/remove_const.hpp>
91#endif
92
93namespace boost { namespace parameter { namespace aux {
94
95 template <typename T>
96#if defined(BOOST_PARAMETER_CAN_USE_MP11)
97 using has_nested_template_fn = typename ::boost::parameter::aux
98 ::has_nested_template_fn_impl<typename ::std::remove_const<T>::type>
99 ::type;
100#else
101 struct has_nested_template_fn
102 : ::boost::parameter::aux::has_nested_template_fn_impl<
103 typename ::boost::remove_const<T>::type
104 >::type
105 {
106 };
107#endif
108}}} // namespace boost::parameter::aux
109
110#endif // include guard
111
112

source code of include/boost/parameter/aux_/has_nested_template_fn.hpp