[prev in list] [next in list] [prev in thread] [next in thread]
List: boost
Subject: Re: [boost] boost::trim_copy(boost::string_view()); // error
From: Peter Dimov via Boost <boost () lists ! boost ! org>
Date: 2021-10-31 13:05:44
Message-ID: 183b01d7ce58$045fcc70$0d1f6550$ () gmail ! com
[Download RAW message or body]
Olaf van der Spek wrote:
> Hi,
>
> Why does the overload for boost::string_view not work? The std one works.
> Could it be made to work?
>
> #include <boost/algorithm/string.hpp>
> #include <boost/utility/string_ref.hpp>
> #include <boost/utility/string_view.hpp>
> #include <iostream>
> #include <string_view>
>
> int main()
> {
> boost::trim_copy(boost::string_view()); // error
> boost::trim_copy(std::string_view());
> }
std::string_view doesn't work either in C++17; it requires constructor (5) in
https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view
that was added in C++20.
boost::string_view can be made to work by the addition of a constructor
that takes two pointers to char, like this
https://github.com/boostorg/core/blob/12f5f51427fbc9d27f56e5de002b0008fea420c9/include/boost/core/detail/string_view.hpp#L364-L368
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic