Fix compile time string search in CTTI (#42)

Fixes https://github.com/boostorg/type_index/issues/41
This commit is contained in:
Antony Polukhin
2025-03-19 10:22:58 +03:00
committed by GitHub
parent a418e8414b
commit 3f72edd065

View File

@ -196,11 +196,12 @@ constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(0, 0, ""); }
template <unsigned int ArrayLength>
BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin) noexcept {
constexpr auto skip_value = detail::skip(); // to have the same `.until_runtime` value in code below
const char* const it = detail::constexpr_search(
begin, begin + ArrayLength,
skip().until_runtime, skip().until_runtime + skip().until_runtime_length
skip_value.until_runtime, skip_value.until_runtime + skip_value.until_runtime_length
);
return (it == begin + ArrayLength ? begin : it + skip().until_runtime_length);
return (it == begin + ArrayLength ? begin : it + skip_value.until_runtime_length);
}
template <unsigned int ArrayLength>