diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index fedfbc9..c8343c8 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -31,6 +31,10 @@ #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) # include #endif +#if BOOST_CXX_VERSION >= 202000L +# include +# include +#endif namespace boost { @@ -1216,4 +1220,29 @@ typedef basic_string_view u8string_view; } // namespace core } // namespace boost +// std::common_reference support +// needed for iterators that have reference=string_view and value_type=std::string + +#if BOOST_CXX_VERSION >= 202000L && defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 201907L + +template class Q1, template class Q2> +struct std::basic_common_reference< + boost::core::basic_string_view, + std::basic_string, A>, + Q1, Q2> +{ + using type = boost::core::basic_string_view; +}; + +template class Q1, template class Q2> +struct std::basic_common_reference< + std::basic_string, A>, + boost::core::basic_string_view, + Q1, Q2> +{ + using type = boost::core::basic_string_view; +}; + +#endif + #endif // #ifndef BOOST_CORE_STRING_VIEW_HPP_INCLUDED