| 1 | // Copyright 2022 Peter Dimov. |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // https://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #include <boost/type_traits/integral_constant.hpp> |
| 6 | #include <cstddef> |
| 7 | |
| 8 | struct X1 |
| 9 | { |
| 10 | char const* begin() const; |
| 11 | char const* end() const; |
| 12 | char const* data() const; |
| 13 | std::size_t size() const; |
| 14 | }; |
| 15 | |
| 16 | struct X2 |
| 17 | { |
| 18 | char const* begin() const; |
| 19 | char const* end() const; |
| 20 | char const* data() const; |
| 21 | std::size_t size() const; |
| 22 | }; |
| 23 | |
| 24 | struct X3 |
| 25 | { |
| 26 | char const* begin() const; |
| 27 | char const* end() const; |
| 28 | char const* data() const; |
| 29 | std::size_t size() const; |
| 30 | }; |
| 31 | |
| 32 | namespace boost |
| 33 | { |
| 34 | namespace container_hash |
| 35 | { |
| 36 | |
| 37 | template<class T> struct is_contiguous_range; |
| 38 | template<> struct is_contiguous_range<X2>: boost::false_type {}; |
| 39 | |
| 40 | template<class T> struct is_range; |
| 41 | template<> struct is_range<X3>: boost::false_type {}; |
| 42 | |
| 43 | } // namespace container_hash |
| 44 | } // namespace boost |
| 45 | |
| 46 | #include <boost/container_hash/is_contiguous_range.hpp> |
| 47 | #include <boost/core/lightweight_test_trait.hpp> |
| 48 | |
| 49 | int main() |
| 50 | { |
| 51 | using boost::container_hash::is_contiguous_range; |
| 52 | |
| 53 | #if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700) && !BOOST_WORKAROUND(BOOST_MSVC, < 1910) |
| 54 | |
| 55 | BOOST_TEST_TRAIT_TRUE((is_contiguous_range<X1>)); |
| 56 | |
| 57 | #endif |
| 58 | |
| 59 | BOOST_TEST_TRAIT_FALSE((is_contiguous_range<X2>)); |
| 60 | BOOST_TEST_TRAIT_FALSE((is_contiguous_range<X3>)); |
| 61 | |
| 62 | return boost::report_errors(); |
| 63 | } |
| 64 |
