Skip to content

Commit

Permalink
Fix issue with wrap(string_view&&) being ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Nov 1, 2023
1 parent 83e307a commit 38fa1f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/scn/detail/range.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ namespace scn {

#if SCN_HAS_STRING_VIEW
template <typename CharT>
static auto impl(const std::basic_string_view<CharT>& str,
priority_tag<1>) noexcept
static auto impl(std::basic_string_view<CharT> str,
priority_tag<2>) noexcept
-> range_wrapper<basic_string_view<CharT>>
{
return {basic_string_view<CharT>{str.data(), str.size()}};
Expand Down
7 changes: 7 additions & 0 deletions test/std_string_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ TEST_CASE("getline std::string_view")
CHECK_EQ(std::memcmp(sv.data(), "foo", 3), 0);
}

TEST_CASE("input std::string_view")
{
std::string_view out;
auto ret = scn::scan(std::string_view{"foo"}, "{}", out);
CHECK(ret);
CHECK_EQ(out, "foo");
}
#endif

0 comments on commit 38fa1f0

Please sign in to comment.