summaryrefslogtreecommitdiff
path: root/boost/type_traits/detail/detector.hpp
blob: 007a4dc8e1ef8c2a4afefda08319dfbff08dca2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Copyright 2017-2018 Glen Joseph Fernandes
<glenjofe -at- gmail.com>

Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#ifndef BOOST_TT_DETAIL_DETECTOR_HPP_INCLUDED
#define BOOST_TT_DETAIL_DETECTOR_HPP_INCLUDED

#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/make_void.hpp>

namespace boost {
namespace detail {

template<class T>
using detector_t = typename boost::make_void<T>::type;

template<class Default, class, template<class...> class, class...>
struct detector {
    using value_t = boost::false_type;
    using type = Default;
};

template<class Default, template<class...> class Op, class... Args>
struct detector<Default, detector_t<Op<Args...> >, Op, Args...> {
    using value_t = boost::true_type;
    using type = Op<Args...>;
};

} /* detail */
} /* boost */

#endif