Skip to content

Commit

Permalink
fix: fully qualify all usages of concat
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Mar 27, 2024
1 parent bade99c commit 34146ee
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/pybind11/detail/descr.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ constexpr auto concat(const descr<N, Ts...> &d, const Args &...args) {
#else
template <size_t N, typename... Ts, typename... Args>
constexpr auto concat(const descr<N, Ts...> &d, const Args &...args)
-> decltype(std::declval<descr<N + 2, Ts...>>() + concat(args...)) {
return d + const_name(", ") + concat(args...);
-> decltype(std::declval<descr<N + 2, Ts...>>() + ::pybind11::detail::concat(args...)) {
return d + const_name(", ") + ::pybind11::detail::concat(args...);
}
#endif

Expand Down
5 changes: 3 additions & 2 deletions include/pybind11/eigen/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct eigen_tensor_helper<Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexTy

template <size_t... Is>
struct helper<index_sequence<Is...>> {
static constexpr auto value = concat(const_name(((void) Is, "?"))...);
static constexpr auto value = ::pybind11::detail::concat(const_name(((void) Is, "?"))...);
};

static constexpr auto dimensions_descriptor
Expand Down Expand Up @@ -104,7 +104,8 @@ struct eigen_tensor_helper<
return get_shape() == shape;
}

static constexpr auto dimensions_descriptor = concat(const_name<Indices>()...);
static constexpr auto dimensions_descriptor
= ::pybind11::detail::concat(const_name<Indices>()...);

template <typename... Args>
static Type *alloc(Args &&...args) {
Expand Down
3 changes: 2 additions & 1 deletion include/pybind11/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ struct type_caster<std::function<Return(Args...)>> {
}

PYBIND11_TYPE_CASTER(type,
const_name("Callable[[") + concat(make_caster<Args>::name...)
const_name("Callable[[")
+ ::pybind11::detail::concat(make_caster<Args>::name...)
+ const_name("], ") + make_caster<retval_type>::name
+ const_name("]"));
};
Expand Down
2 changes: 1 addition & 1 deletion include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ struct array_info<std::array<T, N>> {
}

static constexpr auto extents = const_name<array_info<T>::is_array>(
concat(const_name<N>(), array_info<T>::extents), const_name<N>());
::pybind11::detail::concat(const_name<N>(), array_info<T>::extents), const_name<N>());
};
// For numpy we have special handling for arrays of characters, so we don't include
// the size in the array extents.
Expand Down
3 changes: 2 additions & 1 deletion include/pybind11/stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ struct variant_caster<V<Ts...>> {

using Type = V<Ts...>;
PYBIND11_TYPE_CASTER(Type,
const_name("Union[") + detail::concat(make_caster<Ts>::name...)
const_name("Union[")
+ ::pybind11::detail::concat(make_caster<Ts>::name...)
+ const_name("]"));
};

Expand Down
11 changes: 6 additions & 5 deletions include/pybind11/typing.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ PYBIND11_NAMESPACE_BEGIN(detail)

template <typename... Types>
struct handle_type_name<typing::Tuple<Types...>> {
static constexpr auto name
= const_name("tuple[") + concat(make_caster<Types>::name...) + const_name("]");
static constexpr auto name = const_name("tuple[")
+ ::pybind11::detail::concat(make_caster<Types>::name...)
+ const_name("]");
};

template <>
Expand Down Expand Up @@ -108,9 +109,9 @@ struct handle_type_name<typing::Iterator<T>> {
template <typename Return, typename... Args>
struct handle_type_name<typing::Callable<Return(Args...)>> {
using retval_type = conditional_t<std::is_same<Return, void>::value, void_type, Return>;
static constexpr auto name = const_name("Callable[[") + concat(make_caster<Args>::name...)
+ const_name("], ") + make_caster<retval_type>::name
+ const_name("]");
static constexpr auto name
= const_name("Callable[[") + ::pybind11::detail::concat(make_caster<Args>::name...)
+ const_name("], ") + make_caster<retval_type>::name + const_name("]");
};

PYBIND11_NAMESPACE_END(detail)
Expand Down

0 comments on commit 34146ee

Please sign in to comment.