Boost logo

Boost :

Subject: Re: [boost] [gsoc17] Project1: Static map: Can I implement the competency test in g++-7?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-03-13 13:11:12

On 03/13/17 15:49, Vic Luo via Boost wrote:
>> This is a long known issue. You should implement your own string
>> comparison routine which is constexpr. As you mention, Boost's
>> string_view is constrained by the STL's implementation of char_traits.
> Would it be OK to implement our own constexpr char_traits(just replace ::compare, ::length), then use
> boost::basic_string_view<char, patched_char_traits<char>> as our CONSTEXPR_STRING_VIEW and compare views with
> constexpr boost::string_view::compare(a, b) == 0? This way seems to work on my g++-6 which prevents
> reinventing the wheel.

First, it would make interaction with std::string (and its cousins)
problematic since they would still use std::char_traits, not

Second, there is currently no way to select constexpr or runtime
implementation of a function depending on the arguments. This means that
the optimized versions of strlen/strcmp can't be used when the arguments
of string_view are runtime values.

IMO, the second problem is a showstopper for constexpr string_view.

Boost list run by bdawes at, gregod at, cpdaniel at, john at