]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/test/utils/is_cstring.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / test / utils / is_cstring.hpp
index 12326b0418769b21b08133c346c540634da9f9bf..ffec3657ac6ead948c74a2e9a5cc6dfecef22b49 100644 (file)
@@ -5,11 +5,8 @@
 
 //  See http://www.boost.org/libs/test for the library home page.
 //
-//  File        : $RCSfile$
-//
-//  Version     : $Revision$
-//
-//  Description : defines the is_cstring type trait
+//! @file
+//! Defines the is_cstring type trait
 // ***************************************************************************
 
 #ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP
 #include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp>
 #include <string>
 
+#if defined(BOOST_TEST_STRING_VIEW)
+#include <string_view>
+#endif
+
 //____________________________________________________________________________//
 
 namespace boost {
@@ -53,16 +54,16 @@ template<>
 struct is_cstring_impl<wchar_t*> : public mpl::true_ {};
 
 template <typename T, bool is_cstring = is_cstring_impl<typename boost::decay<T>::type>::value >
-struct deduce_cstring_impl;
+struct deduce_cstring_transform_impl;
 
 template <typename T, bool is_cstring >
-struct deduce_cstring_impl<T&, is_cstring> : public deduce_cstring_impl<T, is_cstring>{};
+struct deduce_cstring_transform_impl<T&, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{};
 
 template <typename T, bool is_cstring >
-struct deduce_cstring_impl<T const, is_cstring> : public deduce_cstring_impl<T, is_cstring>{};
+struct deduce_cstring_transform_impl<T const, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{};
 
 template <typename T>
-struct deduce_cstring_impl<T, true> {
+struct deduce_cstring_transform_impl<T, true> {
     typedef typename boost::add_const<
         typename boost::remove_pointer<
             typename boost::decay<T>::type
@@ -72,7 +73,7 @@ struct deduce_cstring_impl<T, true> {
 };
 
 template <typename T>
-struct deduce_cstring_impl< T, false > {
+struct deduce_cstring_transform_impl< T, false > {
     typedef typename
         boost::remove_const<
             typename boost::remove_reference<T>::type
@@ -80,10 +81,21 @@ struct deduce_cstring_impl< T, false > {
 };
 
 template <typename T>
-struct deduce_cstring_impl< std::basic_string<T, std::char_traits<T> >, false > {
+struct deduce_cstring_transform_impl< std::basic_string<T, std::char_traits<T> >, false > {
     typedef boost::unit_test::basic_cstring<typename boost::add_const<T>::type> type;
 };
 
+#if defined(BOOST_TEST_STRING_VIEW)
+template <typename T>
+struct deduce_cstring_transform_impl< std::basic_string_view<T, std::char_traits<T> >, false > {
+private:
+    using sv_t = std::basic_string_view<T, std::char_traits<T> > ;
+  
+public:
+    using type = stringview_cstring_helper<typename boost::add_const<T>::type, sv_t>;
+};
+#endif
+
 } // namespace ut_detail
 
 template<typename T>
@@ -98,16 +110,21 @@ struct is_cstring_comparable< T, true > : public mpl::true_ {};
 template<typename T>
 struct is_cstring_comparable< std::basic_string<T, std::char_traits<T> >, false > : public mpl::true_ {};
 
+#if defined(BOOST_TEST_STRING_VIEW)
+template<typename T>
+struct is_cstring_comparable< std::basic_string_view<T, std::char_traits<T> >, false > : public mpl::true_ {};
+#endif
+
 template<typename T>
 struct is_cstring_comparable< boost::unit_test::basic_cstring<T>, false > : public mpl::true_ {};
 
 template <class T>
-struct deduce_cstring {
+struct deduce_cstring_transform {
     typedef typename
         boost::remove_const<
             typename boost::remove_reference<T>::type
         >::type U;
-    typedef typename ut_detail::deduce_cstring_impl<typename boost::decay<U>::type>::type type;
+    typedef typename ut_detail::deduce_cstring_transform_impl<typename boost::decay<U>::type>::type type;
 };
 
 } // namespace unit_test