]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/is_detected_test.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_detected_test.cpp
CommitLineData
11fdf7f2
TL
1/*
2Copyright 2017-2018 Glen Joseph Fernandes
92f5a8d4 3(glenjofe@gmail.com)
11fdf7f2
TL
4
5Distributed under the Boost Software License,
6Version 1.0. (See accompanying file LICENSE_1_0.txt
7or copy at http://www.boost.org/LICENSE_1_0.txt)
8*/
9#include <boost/config.hpp>
10#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
11 !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
12#ifdef TEST_STD
13#include <type_traits>
14#else
15#include <boost/type_traits/is_detected.hpp>
16#endif
17#include "check_integral_constant.hpp"
18#include "check_type.hpp"
19
20#define CHECK_FALSE(e) BOOST_CHECK_INTEGRAL_CONSTANT(e, false)
21#define CHECK_TRUE(e) BOOST_CHECK_INTEGRAL_CONSTANT(e, true)
22
23template<class T>
24using type_t = typename T::type;
25
26struct has_type {
27 using type = char;
28};
29
30struct no_type { };
31
32TT_TEST_BEGIN(is_detected)
33
34CHECK_FALSE((::tt::is_detected<type_t, int>::value));
35CHECK_TRUE((::tt::is_detected<type_t, has_type>::value));
36CHECK_FALSE((::tt::is_detected<type_t, no_type>::value));
37#ifndef BOOST_NO_CXX14_VARIABLE_TEMPLATES
38CHECK_FALSE((::tt::is_detected_v<type_t, int>));
39CHECK_TRUE((::tt::is_detected_v<type_t, has_type>));
40CHECK_FALSE((::tt::is_detected_v<type_t, no_type>));
41#endif
42
43TT_TEST_END
44#else
45int main()
46{
47 return 0;
48}
49#endif