mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-28 13:52:46 +00:00
add c++17 guard
This commit is contained in:
parent
fe21e0f8d7
commit
4a443a7adf
@ -1329,14 +1329,18 @@ object object_or_cast(T &&o) {
|
||||
return pybind11::cast(std::forward<T>(o));
|
||||
}
|
||||
|
||||
|
||||
#if defined(PYBIND11_CPP17)
|
||||
// Declared in pytypes.h:
|
||||
// Written here so make_caster<T> can be used
|
||||
template <typename D>
|
||||
template <typename T>
|
||||
str_attr_accessor object_api<D>::attr_with_type(const char *key) const {
|
||||
annotations()[key] = make_caster<T>::name.text;
|
||||
static constexpr auto name = make_caster<T>::name;
|
||||
annotations()[key] = name.text;
|
||||
return {derived(), key};
|
||||
}
|
||||
#endif
|
||||
|
||||
// Placeholder type for the unneeded (and dead code) static variable in the
|
||||
// PYBIND11_OVERRIDE_OVERRIDE macro
|
||||
|
@ -113,10 +113,11 @@ public:
|
||||
/// See above (the only difference is that the key is provided as a string literal)
|
||||
str_attr_accessor attr(const char *key) const;
|
||||
|
||||
#if defined(PYBIND11_CPP17)
|
||||
// attr_with_type is implemented in cast.h:
|
||||
template <typename T>
|
||||
str_attr_accessor attr_with_type(const char *key) const;
|
||||
|
||||
#endif
|
||||
/** \rst
|
||||
Matches * unpacking in Python, e.g. to unpack arguments out of a ``tuple``
|
||||
or ``list`` for a function call. Applying another * to the result yields
|
||||
|
Loading…
Reference in New Issue
Block a user