Skip to content

Commit e9176c5

Browse files
committed
🐛 Fix string_view construction
Problem: - `string_view`'s constructor takes a `char const *` and a size, not an iterator and a size. On platforms where an array iterator is not a simple pointer, this fails. Solution: - Use `data` instead of `cbegin` to access the string data.
1 parent 242020e commit e9176c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/stdx/ct_string.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ template <std::size_t N> struct ct_string {
5252
constexpr static std::integral_constant<bool, N == 1U> empty{};
5353

5454
constexpr explicit(true) operator std::string_view() const {
55-
return std::string_view{value.cbegin(), size()};
55+
return std::string_view{value.data(), size()};
5656
}
5757

5858
std::array<char, N> value{};

0 commit comments

Comments
 (0)