Remove unnecessary detail::

This function already has a `using namespace detail`, so all the
`detail::` qualifications are not needed.
This commit is contained in:
Jason Rhinelander 2018-01-12 12:06:46 -04:00
parent adbc8111bc
commit 657a51e889

View File

@ -94,7 +94,7 @@ protected:
template <typename Func, typename Return, typename... Args, typename... Extra> template <typename Func, typename Return, typename... Args, typename... Extra>
void initialize(Func &&f, Return (*)(Args...), const Extra&... extra) { void initialize(Func &&f, Return (*)(Args...), const Extra&... extra) {
using namespace detail; using namespace detail;
struct capture { detail::remove_reference_t<Func> f; }; struct capture { remove_reference_t<Func> f; };
/* Store the function including any extra state it might have (e.g. a lambda capture object) */ /* Store the function including any extra state it might have (e.g. a lambda capture object) */
auto rec = make_function_record(); auto rec = make_function_record();
@ -113,23 +113,23 @@ protected:
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
if (!std::is_trivially_destructible<Func>::value) if (!std::is_trivially_destructible<Func>::value)
rec->free_data = [](detail::function_record *r) { ((capture *) &r->data)->~capture(); }; rec->free_data = [](function_record *r) { ((capture *) &r->data)->~capture(); };
} else { } else {
rec->data[0] = new capture { std::forward<Func>(f) }; rec->data[0] = new capture { std::forward<Func>(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 */ /* Type casters for the function arguments and return value */
using cast_in = detail::argument_loader<Args...>; using cast_in = argument_loader<Args...>;
using cast_out = detail::make_caster< using cast_out = make_caster<
detail::conditional_t<std::is_void<Return>::value, detail::void_type, Return> conditional_t<std::is_void<Return>::value, void_type, Return>
>; >;
static_assert(detail::expected_num_args<Extra...>(sizeof...(Args), cast_in::has_args, cast_in::has_kwargs), static_assert(expected_num_args<Extra...>(sizeof...(Args), cast_in::has_args, cast_in::has_kwargs),
"The number of argument annotations does not match the number of function arguments"); "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 */ /* 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; cast_in args_converter;
/* Try to cast the function arguments into the C++ domain */ /* Try to cast the function arguments into the C++ domain */
@ -137,7 +137,7 @@ protected:
return PYBIND11_TRY_NEXT_OVERLOAD; return PYBIND11_TRY_NEXT_OVERLOAD;
/* Invoke call policy pre-call hook */ /* Invoke call policy pre-call hook */
detail::process_attributes<Extra...>::precall(call); process_attributes<Extra...>::precall(call);
/* Get a pointer to the capture object */ /* Get a pointer to the capture object */
auto data = (sizeof(capture) <= sizeof(call.func.data) auto data = (sizeof(capture) <= sizeof(call.func.data)
@ -145,23 +145,23 @@ protected:
capture *cap = const_cast<capture *>(reinterpret_cast<const capture *>(data)); capture *cap = const_cast<capture *>(reinterpret_cast<const capture *>(data));
/* Override policy for rvalues -- usually to enforce rvp::move on an rvalue */ /* Override policy for rvalues -- usually to enforce rvp::move on an rvalue */
const auto policy = detail::return_value_policy_override<Return>::policy(call.func.policy); const auto policy = return_value_policy_override<Return>::policy(call.func.policy);
/* Function scope guard -- defaults to the compile-to-nothing `void_type` */ /* Function scope guard -- defaults to the compile-to-nothing `void_type` */
using Guard = detail::extract_guard_t<Extra...>; using Guard = extract_guard_t<Extra...>;
/* Perform the function call */ /* Perform the function call */
handle result = cast_out::cast( handle result = cast_out::cast(
std::move(args_converter).template call<Return, Guard>(cap->f), policy, call.parent); std::move(args_converter).template call<Return, Guard>(cap->f), policy, call.parent);
/* Invoke call policy post-call hook */ /* Invoke call policy post-call hook */
detail::process_attributes<Extra...>::postcall(call, result); process_attributes<Extra...>::postcall(call, result);
return result; return result;
}; };
/* Process any user-provided function attributes */ /* Process any user-provided function attributes */
detail::process_attributes<Extra...>::init(extra..., rec); process_attributes<Extra...>::init(extra..., rec);
/* Generate a readable signature describing the function's arguments and return value types */ /* Generate a readable signature describing the function's arguments and return value types */
static constexpr auto signature = _("(") + cast_in::arg_names + _(") -> ") + cast_out::name; static constexpr auto signature = _("(") + cast_in::arg_names + _(") -> ") + cast_out::name;