format_descriptor::format() now yields std::string
This is required since format descriptors for string types that
were using PYBIND11_DESCR were causing problems on C++14 on Linux.
Although this is technically a breaking change, it shouldn't cause
problems since the only use of format strings is passing them to
buffer_info constructor which expects std::string.
Note: for non-structured types, the const char * value is still
accessible via ::value for compatibility purpose.
diff --git a/include/pybind11/common.h b/include/pybind11/common.h
index 9db37ad..eff105c 100644
--- a/include/pybind11/common.h
+++ b/include/pybind11/common.h
@@ -333,14 +333,14 @@
/// Format strings for basic number types
#define PYBIND11_DECL_FMT(t, v) template<> struct format_descriptor<t> \
{ static constexpr const char* value = v; /* for backwards compatibility */ \
- static constexpr const char* format() { return value; } }
+ static std::string format() { return value; } }
template <typename T, typename SFINAE = void> struct format_descriptor { };
template <typename T> struct format_descriptor<T, typename std::enable_if<std::is_integral<T>::value>::type> {
static constexpr const char value[2] =
{ "bBhHiIqQ"[detail::log2(sizeof(T))*2 + (std::is_unsigned<T>::value ? 1 : 0)], '\0' };
- static constexpr const char* format() { return value; }
+ static std::string format() { return value; }
};
template <typename T> constexpr const char format_descriptor<