use std::is_same<...>::value instead of std::is_same_v<...> for c++11 compliance

This commit is contained in:
Guillaume Giraud 2022-03-16 16:31:01 +01:00
parent 9fb90cb30c
commit 19d8f06c52

View File

@ -438,9 +438,9 @@ struct string_caster {
cast(const StringType &src, return_value_policy /* policy */, handle /* parent */) { cast(const StringType &src, return_value_policy /* policy */, handle /* parent */) {
const char *buffer = reinterpret_cast<const char *>(src.data()); const char *buffer = reinterpret_cast<const char *>(src.data());
auto nbytes = ssize_t(src.size() * sizeof(CharT)); auto nbytes = ssize_t(src.size() * sizeof(CharT));
if (std::is_same_v<CharT, uint8_t> if (std::is_same<CharT, uint8_t>::value
#if defined(PYBIND11_CPP17) #if defined(PYBIND11_CPP17)
or std::is_same_v<CharT, std::byte> || std::is_same<CharT, std::byte>::value
#endif #endif
) { ) {
return PyBytes_FromStringAndSize(buffer, nbytes); return PyBytes_FromStringAndSize(buffer, nbytes);