27 Nov
2019
27 Nov
'19
12:24 a.m.
Gavin Lambert wrote:
On 27/11/2019 06:46, Peter Dimov wrote:
Vinnie Falco wrote:
In which use-cases do you anticipate the need for a constexpr static_string?
When manipulating strings at compile time? Such as s1 += s2?
Wouldn't that use case be better served with an immutable string and operator+?
Not in general. constexpr string_view f( int x ); constexpr auto g( int n ) { fixed_string<512> s; for( int i = 0; i < n; ++i ) { s += f( i ); } return s; } You can rewrite this specific example using recursion but in general, it'd be painful and unreadable.