Minor tweaks looking at the PR with a fresh eye.

This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-07-11 10:14:26 -07:00
parent 70f645f6d1
commit 75c659866f
4 changed files with 8 additions and 8 deletions

View File

@ -122,7 +122,7 @@ struct int_to_str : int_to_str<Rem / 10, Rem % 10, Digits...> {};
template <size_t... Digits> template <size_t... Digits>
struct int_to_str<0, Digits...> { struct int_to_str<0, Digits...> {
// WARNING: This only works with C++17 or higher. // WARNING: This only works with C++17 or higher.
// src_loc not tracked (irrelevant in this situation, at least at the moment). // src_loc not tracked (not needed in this situation, at least at the moment).
static constexpr auto digits static constexpr auto digits
= descr<sizeof...(Digits)>(src_loc{nullptr, 0}, ('0' + Digits)...); = descr<sizeof...(Digits)>(src_loc{nullptr, 0}, ('0' + Digits)...);
}; };
@ -150,7 +150,7 @@ constexpr enable_if_t<!B, T2> const_name(const T1 &, const T2 &d) {
template <size_t Size> template <size_t Size>
auto constexpr const_name() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> { auto constexpr const_name() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> {
// src_loc not tracked (irrelevant in this situation, at least at the moment). // src_loc not tracked (not needed in this situation, at least at the moment).
return int_to_str<Size / 10, Size % 10>::digits; return int_to_str<Size / 10, Size % 10>::digits;
} }
@ -190,7 +190,7 @@ constexpr enable_if_t<!B, T2> _(const T1 &d1, const T2 &d2) {
template <size_t Size> template <size_t Size>
auto constexpr _() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> { auto constexpr _() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> {
// src_loc not tracked (irrelevant in this situation, at least at the moment). // src_loc not tracked (not needed in this situation, at least at the moment).
return const_name<Size>(); return const_name<Size>();
} }
template <typename Type> template <typename Type>

View File

@ -58,8 +58,8 @@ inline std::string source_file_line_basename(const char *sfl) {
return std::string(sfl + i_base); return std::string(sfl + i_base);
} }
# ifndef PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_THROW_DISABLED # ifndef PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_THROW_DISABLED
# define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_THROW_DISABLED false # define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_THROW_DISABLED false
# endif # endif
inline void type_caster_odr_guard_impl(const std::type_info &intrinsic_type_info, inline void type_caster_odr_guard_impl(const std::type_info &intrinsic_type_info,
@ -129,7 +129,7 @@ tu_local_no_data_always_false
= []() { = []() {
type_caster_odr_guard_impl(typeid(IntrinsicType), type_caster_odr_guard_impl(typeid(IntrinsicType),
TypeCasterType::name.sloc, TypeCasterType::name.sloc,
PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_THROW_DISABLED); PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_THROW_DISABLED);
return tu_local_no_data_always_false(); return tu_local_no_data_always_false();
}(); }();

View File

@ -1,4 +1,4 @@
#define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_THROW_DISABLED true #define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_THROW_DISABLED true
#include "pybind11_tests.h" #include "pybind11_tests.h"
// For test of real-world issue. // For test of real-world issue.

View File

@ -1,4 +1,4 @@
#define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_THROW_DISABLED true #define PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_THROW_DISABLED true
#include "pybind11_tests.h" #include "pybind11_tests.h"
// For test of real-world issue. // For test of real-world issue.