diff --git a/include/pybind11/detail/descr.h b/include/pybind11/detail/descr.h index 357e45be3..743bbf2ee 100644 --- a/include/pybind11/detail/descr.h +++ b/include/pybind11/detail/descr.h @@ -238,12 +238,25 @@ constexpr descr concat(const descr &descr) { return descr; } +#if defined(PYBIND11_CPP17) +template +constexpr descr operator,(const descr &a, + const descr &b) { + return a + const_name(", ") + b; +} + +template +constexpr auto concat(const descr &d, const Args &...args) { + return (d, ..., args); +} +#else template constexpr auto concat(const descr &d, const Args &...args) -> decltype(std::declval>() + concat(args...)) { // Ensure that src_loc of existing descr is used. return d + const_name(", ", src_loc{nullptr, 0}) + concat(args...); } +#endif template constexpr descr type_descr(const descr &descr) {