| 1 | // Copyright 2021 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/core/detail/string_view.hpp> |
| 6 | #include <boost/core/lightweight_test_trait.hpp> |
| 7 | #include <boost/config/pragma_message.hpp> |
| 8 | #include <boost/config.hpp> |
| 9 | #include <string> |
| 10 | |
| 11 | #if defined(BOOST_NO_CXX20_HDR_CONCEPTS) |
| 12 | |
| 13 | BOOST_PRAGMA_MESSAGE( "Skipping test because BOOST_NO_CXX20_HDR_CONCEPTS is defined" ) |
| 14 | int main() {} |
| 15 | |
| 16 | #else |
| 17 | |
| 18 | #include <concepts> |
| 19 | #include <type_traits> |
| 20 | |
| 21 | using T = std::common_reference_t< boost::core::string_view&&, std::string& >; |
| 22 | |
| 23 | static_assert( std::common_reference_with< boost::core::string_view&&, std::string& > ); |
| 24 | static_assert( std::common_reference_with< boost::core::wstring_view&&, std::wstring const& > ); |
| 25 | |
| 26 | int main() |
| 27 | { |
| 28 | BOOST_TEST_TRAIT_SAME( std::common_reference_t< boost::core::string_view&&, std::string& >, boost::core::string_view ); |
| 29 | BOOST_TEST_TRAIT_SAME( std::common_reference_t< boost::core::wstring_view&&, std::wstring const& >, boost::core::wstring_view ); |
| 30 | |
| 31 | return boost::report_errors(); |
| 32 | } |
| 33 | |
| 34 | #endif |
| 35 | |