Skip to content

Commit ce58ea9

Browse files
authored
Fix assertion failure when converting empty subrange to std::string_view (#3080)
1 parent a30b293 commit ce58ea9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

axmol/tlx/utility.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ inline void resize_and_overrite(_SeqCont& cont, size_t size, _Operation op)
106106
template <typename _Subrgn>
107107
inline std::string_view to_string_view(_Subrgn&& subrgn)
108108
{
109-
return std::string_view{&*subrgn.begin(), static_cast<size_t>(std::ranges::distance(subrgn))};
109+
return std::string_view{std::ranges::data(subrgn), static_cast<size_t>(std::ranges::size(subrgn))};
110110
}
111111

112-
113112
/**
114113
* @brief Safely copy a string into a fixed-size C-style buffer.
115114
*

0 commit comments

Comments
 (0)