diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/type_traits/test/is_detected_convertible.cpp | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/type_traits/test/is_detected_convertible.cpp')
-rw-r--r-- | src/boost/libs/type_traits/test/is_detected_convertible.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/boost/libs/type_traits/test/is_detected_convertible.cpp b/src/boost/libs/type_traits/test/is_detected_convertible.cpp new file mode 100644 index 000000000..2a5ef2c1f --- /dev/null +++ b/src/boost/libs/type_traits/test/is_detected_convertible.cpp @@ -0,0 +1,49 @@ +/* +Copyright 2017-2018 Glen Joseph Fernandes +(glenjofe@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) +*/ +#include <boost/config.hpp> +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +#ifdef TEST_STD +#include <type_traits> +#else +#include <boost/type_traits/is_detected_convertible.hpp> +#endif +#include "check_integral_constant.hpp" +#include "check_type.hpp" + +#define CHECK_FALSE(e) BOOST_CHECK_INTEGRAL_CONSTANT(e, false) +#define CHECK_TRUE(e) BOOST_CHECK_INTEGRAL_CONSTANT(e, true) + +template<class T> +using type_t = typename T::type; + +struct has_type { + using type = char; +}; + +struct no_type { }; + +TT_TEST_BEGIN(is_detected_convertible) + +CHECK_FALSE((::tt::is_detected_convertible<long, type_t, int>::value)); +CHECK_TRUE((::tt::is_detected_convertible<long, type_t, has_type>::value)); +CHECK_FALSE((::tt::is_detected_convertible<long, type_t, no_type>::value)); +#ifndef BOOST_NO_CXX14_VARIABLE_TEMPLATES +CHECK_FALSE((::tt::is_detected_convertible_v<long, type_t, int>)); +CHECK_TRUE((::tt::is_detected_convertible_v<long, type_t, has_type>)); +CHECK_FALSE((::tt::is_detected_convertible_v<long, type_t, no_type>)); +#endif + +TT_TEST_END +#else +int main() +{ + return 0; +} +#endif |