diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 55bb81698..b1600dc2e 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -946,9 +946,9 @@ struct format_descriptor::value>> { template struct format_descriptor::is_array>> { static std::string format() { - using detail::_; - PYBIND11_DESCR extents = _("(") + detail::array_info::extents() + _(")"); - return extents.text() + format_descriptor>::format(); + using namespace detail; + PYBIND11_DESCR extents = _("(") + array_info::extents() + _(")"); + return extents.text() + format_descriptor>::format(); } }; diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 5769509dd..7723d2a8e 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -92,8 +92,9 @@ protected: /// Special internal constructor for functors, lambda functions, etc. template void initialize(Func &&f, Return (*)(Args...), const Extra&... extra) { + using namespace detail; - struct capture { detail::remove_reference_t f; }; + struct capture { remove_reference_t f; }; /* Store the function including any extra state it might have (e.g. a lambda capture object) */ auto rec = make_function_record(); @@ -112,23 +113,23 @@ protected: # pragma GCC diagnostic pop #endif if (!std::is_trivially_destructible::value) - rec->free_data = [](detail::function_record *r) { ((capture *) &r->data)->~capture(); }; + rec->free_data = [](function_record *r) { ((capture *) &r->data)->~capture(); }; } else { rec->data[0] = new capture { std::forward(f) }; - rec->free_data = [](detail::function_record *r) { delete ((capture *) r->data[0]); }; + rec->free_data = [](function_record *r) { delete ((capture *) r->data[0]); }; } /* Type casters for the function arguments and return value */ - using cast_in = detail::argument_loader; - using cast_out = detail::make_caster< - detail::conditional_t::value, detail::void_type, Return> + using cast_in = argument_loader; + using cast_out = make_caster< + conditional_t::value, void_type, Return> >; - static_assert(detail::expected_num_args(sizeof...(Args), cast_in::has_args, cast_in::has_kwargs), + static_assert(expected_num_args(sizeof...(Args), cast_in::has_args, cast_in::has_kwargs), "The number of argument annotations does not match the number of function arguments"); /* Dispatch code which converts function arguments and performs the actual function call */ - rec->impl = [](detail::function_call &call) -> handle { + rec->impl = [](function_call &call) -> handle { cast_in args_converter; /* Try to cast the function arguments into the C++ domain */ @@ -136,7 +137,7 @@ protected: return PYBIND11_TRY_NEXT_OVERLOAD; /* Invoke call policy pre-call hook */ - detail::process_attributes::precall(call); + process_attributes::precall(call); /* Get a pointer to the capture object */ auto data = (sizeof(capture) <= sizeof(call.func.data) @@ -144,26 +145,25 @@ protected: capture *cap = const_cast(reinterpret_cast(data)); /* Override policy for rvalues -- usually to enforce rvp::move on an rvalue */ - const auto policy = detail::return_value_policy_override::policy(call.func.policy); + const auto policy = return_value_policy_override::policy(call.func.policy); /* Function scope guard -- defaults to the compile-to-nothing `void_type` */ - using Guard = detail::extract_guard_t; + using Guard = extract_guard_t; /* Perform the function call */ handle result = cast_out::cast( std::move(args_converter).template call(cap->f), policy, call.parent); /* Invoke call policy post-call hook */ - detail::process_attributes::postcall(call, result); + process_attributes::postcall(call, result); return result; }; /* Process any user-provided function attributes */ - detail::process_attributes::init(extra..., rec); + process_attributes::init(extra..., rec); /* Generate a readable signature describing the function's arguments and return value types */ - using detail::descr; using detail::_; PYBIND11_DESCR signature = _("(") + cast_in::arg_names() + _(") -> ") + cast_out::name(); /* Register the function with Python from generic (non-templated) code */