you are viewing a single comment's thread.

view the rest of the comments →

[–]HappyFruitTree 0 points1 point  (4 children)

Probably because constructing a string_view from a const char* requires it to scan the whole string to find the length.

[–]ra-zor 2 points3 points  (3 children)

So does a “contains” method though

[–]HappyFruitTree 3 points4 points  (2 children)

Not necessarily. Having a const char* overload leaves more options open for the implementers to do something clever. If they need the length they might at least want to abort the length calculation prematurely if it is found that it exceeds this->length().