mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Add format_descriptor<PyObject *>
Trivial addition, but still in search for a meaningful test.
This commit is contained in:
parent
5bea2a8b86
commit
50eaa3a746
@ -1025,6 +1025,15 @@ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used in
|
|||||||
template <typename T, typename SFINAE = void>
|
template <typename T, typename SFINAE = void>
|
||||||
struct format_descriptor {};
|
struct format_descriptor {};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct format_descriptor<
|
||||||
|
T,
|
||||||
|
detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value>> {
|
||||||
|
static constexpr const char c = 'O';
|
||||||
|
static constexpr const char value[2] = {c, '\0'};
|
||||||
|
static std::string format() { return std::string(1, c); }
|
||||||
|
};
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||||
// Returns the index of the given type in the type char array below, and in the list in numpy.h
|
// Returns the index of the given type in the type char array below, and in the list in numpy.h
|
||||||
// The order here is: bool; 8 ints ((signed,unsigned)x(8,16,32,64)bits); float,double,long double;
|
// The order here is: bool; 8 ints ((signed,unsigned)x(8,16,32,64)bits); float,double,long double;
|
||||||
|
Loading…
Reference in New Issue
Block a user