@@ -39,7 +39,7 @@ class array; // Forward declaration
3939
4040PYBIND11_NAMESPACE_BEGIN (detail)
4141
42- template <> struct handle_type_name<array> { static constexpr auto name = _ (" numpy.ndarray" ); };
42+ template <> struct handle_type_name<array> { static constexpr auto name = const_str (" numpy.ndarray" ); };
4343
4444template <typename type, typename SFINAE = void > struct npy_format_descriptor ;
4545
@@ -290,7 +290,7 @@ template <typename T> struct array_info_scalar {
290290 using type = T;
291291 static constexpr bool is_array = false ;
292292 static constexpr bool is_empty = false ;
293- static constexpr auto extents = _ (" " );
293+ static constexpr auto extents = const_str (" " );
294294 static void append_extents (list& /* shape */ ) { }
295295};
296296// Computes underlying type and a comma-separated list of extents for array
@@ -309,8 +309,8 @@ template <typename T, size_t N> struct array_info<std::array<T, N>> {
309309 array_info<T>::append_extents (shape);
310310 }
311311
312- static constexpr auto extents = _ <array_info<T>::is_array>(
313- concat (_ <N>(), array_info<T>::extents), _ <N>()
312+ static constexpr auto extents = const_str <array_info<T>::is_array>(
313+ concat (const_str <N>(), array_info<T>::extents), const_str <N>()
314314 );
315315};
316316// For numpy we have special handling for arrays of characters, so we don't include
@@ -1021,7 +1021,7 @@ template <typename T>
10211021struct format_descriptor <T, detail::enable_if_t <detail::array_info<T>::is_array>> {
10221022 static std::string format () {
10231023 using namespace detail ;
1024- static constexpr auto extents = _ (" (" ) + array_info<T>::extents + _ (" )" );
1024+ static constexpr auto extents = const_str (" (" ) + array_info<T>::extents + const_str (" )" );
10251025 return extents.text + format_descriptor<remove_all_extents_t <T>>::format ();
10261026 }
10271027};
@@ -1056,28 +1056,28 @@ struct npy_format_descriptor_name;
10561056
10571057template <typename T>
10581058struct npy_format_descriptor_name <T, enable_if_t <std::is_integral<T>::value>> {
1059- static constexpr auto name = _ <std::is_same<T, bool >::value>(
1060- _ (" bool" ), _ <std::is_signed<T>::value>(" numpy.int" , " numpy.uint" ) + _ <sizeof (T)*8 >()
1059+ static constexpr auto name = const_str <std::is_same<T, bool >::value>(
1060+ const_str (" bool" ), const_str <std::is_signed<T>::value>(" numpy.int" , " numpy.uint" ) + const_str <sizeof (T)*8 >()
10611061 );
10621062};
10631063
10641064template <typename T>
10651065struct npy_format_descriptor_name <T, enable_if_t <std::is_floating_point<T>::value>> {
1066- static constexpr auto name = _ <std::is_same<T, float >::value
1066+ static constexpr auto name = const_str <std::is_same<T, float >::value
10671067 || std::is_same<T, const float >::value
10681068 || std::is_same<T, double >::value
10691069 || std::is_same<T, const double >::value>(
1070- _ (" numpy.float" ) + _ <sizeof (T)*8 >(), _ (" numpy.longdouble" )
1070+ const_str (" numpy.float" ) + const_str <sizeof (T)*8 >(), const_str (" numpy.longdouble" )
10711071 );
10721072};
10731073
10741074template <typename T>
10751075struct npy_format_descriptor_name <T, enable_if_t <is_complex<T>::value>> {
1076- static constexpr auto name = _ <std::is_same<typename T::value_type, float >::value
1076+ static constexpr auto name = const_str <std::is_same<typename T::value_type, float >::value
10771077 || std::is_same<typename T::value_type, const float >::value
10781078 || std::is_same<typename T::value_type, double >::value
10791079 || std::is_same<typename T::value_type, const double >::value>(
1080- _ (" numpy.complex" ) + _ <sizeof (typename T::value_type)*16 >(), _ (" numpy.longcomplex" )
1080+ const_str (" numpy.complex" ) + const_str <sizeof (typename T::value_type)*16 >(), const_str (" numpy.longcomplex" )
10811081 );
10821082};
10831083
@@ -1105,7 +1105,7 @@ struct npy_format_descriptor<T, enable_if_t<satisfies_any_of<T, std::is_arithmet
11051105};
11061106
11071107#define PYBIND11_DECL_CHAR_FMT \
1108- static constexpr auto name = _ (" S" ) + _ <N>(); \
1108+ static constexpr auto name = const_str (" S" ) + const_str <N>(); \
11091109 static pybind11::dtype dtype () { return pybind11::dtype (std::string (" S" ) + std::to_string (N)); }
11101110template <size_t N> struct npy_format_descriptor <char [N]> { PYBIND11_DECL_CHAR_FMT };
11111111template <size_t N> struct npy_format_descriptor <std::array<char , N>> { PYBIND11_DECL_CHAR_FMT };
@@ -1117,7 +1117,7 @@ template<typename T> struct npy_format_descriptor<T, enable_if_t<array_info<T>::
11171117public:
11181118 static_assert (!array_info<T>::is_empty, " Zero-sized arrays are not supported" );
11191119
1120- static constexpr auto name = _ (" (" ) + array_info<T>::extents + _ (" )" ) + base_descr::name;
1120+ static constexpr auto name = const_str (" (" ) + array_info<T>::extents + const_str (" )" ) + base_descr::name;
11211121 static pybind11::dtype dtype () {
11221122 list shape;
11231123 array_info<T>::append_extents (shape);
@@ -1705,7 +1705,7 @@ vectorize_extractor(const Func &f, Return (*) (Args ...)) {
17051705}
17061706
17071707template <typename T, int Flags> struct handle_type_name <array_t <T, Flags>> {
1708- static constexpr auto name = _ (" numpy.ndarray[" ) + npy_format_descriptor<T>::name + _ (" ]" );
1708+ static constexpr auto name = const_str (" numpy.ndarray[" ) + npy_format_descriptor<T>::name + const_str (" ]" );
17091709};
17101710
17111711PYBIND11_NAMESPACE_END (detail)
0 commit comments