Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-10-18 01:14:18


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 )
  {
    ...
  }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk