Skip to content

Commit 3a164c3

Browse files
cast: Qualify symbol usage in PYBIND11_TYPE_CASTER
Permits using macro outside of pybind11::detail
1 parent da15bb2 commit 3a164c3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

include/pybind11/cast.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ protected:
8585
\
8686
public: \
8787
static constexpr auto name = py_name; \
88-
template <typename T_, enable_if_t<std::is_same<type, remove_cv_t<T_>>::value, int> = 0> \
89-
static handle cast(T_ *src, return_value_policy policy, handle parent) { \
88+
template <typename T_, \
89+
::pybind11::detail::enable_if_t< \
90+
std::is_same<type, ::pybind11::detail::remove_cv_t<T_>>::value, \
91+
int> = 0> \
92+
static ::pybind11::handle cast( \
93+
T_ *src, ::pybind11::return_value_policy policy, ::pybind11::handle parent) { \
9094
if (!src) \
9195
return none().release(); \
92-
if (policy == return_value_policy::take_ownership) { \
96+
if (policy == ::pybind11::return_value_policy::take_ownership) { \
9397
auto h = cast(std::move(*src), policy, parent); \
9498
delete src; \
9599
return h; \
@@ -100,7 +104,7 @@ public:
100104
operator type &() { return value; } /* NOLINT(bugprone-macro-parentheses) */ \
101105
operator type &&() && { return std::move(value); } /* NOLINT(bugprone-macro-parentheses) */ \
102106
template <typename T_> \
103-
using cast_op_type = pybind11::detail::movable_cast_op_type<T_>
107+
using cast_op_type = ::pybind11::detail::movable_cast_op_type<T_>
104108

105109
template <typename CharT>
106110
using is_std_char_type = any_of<std::is_same<CharT, char>, /* std::string */

0 commit comments

Comments
 (0)