18 Oct
2021
18 Oct
'21
1:14 a.m.
On 10/18/21 4:10 AM, Peter Dimov via Boost wrote:
Andrey Semashev wrote:
Add an overload like this:
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
inline std::string_view api_function( std::string_view str ) { boost::string_view res = api_function( boost::string_view(str.data(), str.size())); return std::string_view(res.data(), res.size()); }
#endif
As I said, all code that used to call the function with a std::string or with a string literal is now broken under C++17.
Ok, let it be template< typename T > inline typename enable_if< is_same< T, std::string_view >, std::string_view
::type api_function( T str ) { ... }