Skip to content

Commit 3f72edd

Browse files
authored
Fix compile time string search in CTTI (#42)
Fixes #41
1 parent a418e84 commit 3f72edd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/boost/type_index/detail/compile_time_type_info.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(0, 0, ""); }
196196

197197
template <unsigned int ArrayLength>
198198
BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin) noexcept {
199+
constexpr auto skip_value = detail::skip(); // to have the same `.until_runtime` value in code below
199200
const char* const it = detail::constexpr_search(
200201
begin, begin + ArrayLength,
201-
skip().until_runtime, skip().until_runtime + skip().until_runtime_length
202+
skip_value.until_runtime, skip_value.until_runtime + skip_value.until_runtime_length
202203
);
203-
return (it == begin + ArrayLength ? begin : it + skip().until_runtime_length);
204+
return (it == begin + ArrayLength ? begin : it + skip_value.until_runtime_length);
204205
}
205206

206207
template <unsigned int ArrayLength>

0 commit comments

Comments
 (0)