This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix constraints for string_view's iterator/sentinel constructor
ClosedPublic

Authored by jloser on Nov 24 2021, 12:38 PM.

Details

Summary

The string_view constructor taking an iterator/sentinel uses concepts
instead of type traits like the Standard states. Using same_as instead
of is_same_v should be harmless. Prefer std::is_same_v instead which is
cheaper to compile. Replace convertible_to with is_convertible_v as
well.

This observation came up while working on
https://reviews.llvm.org/D113161

Diff Detail

Event Timeline

jloser created this revision.Nov 24 2021, 12:38 PM
jloser requested review of this revision.Nov 24 2021, 12:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2021, 12:38 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
jloser updated this revision to Diff 389599.Nov 24 2021, 12:49 PM

Remove the now-unused concepts headers

LGTM!

libcxx/include/string_view
194–195

Please check whether we can remove either/both of these headers now.

jloser marked an inline comment as done.Nov 24 2021, 1:02 PM
jloser added inline comments.
libcxx/include/string_view
194–195

I removed them and it should be fine since they were only added in 4be7f48960980831a9b744c96f38ddb7dc7848ce when I implemented the iterator/sentinel constructor. Nobody else is using them in this file.

ldionne accepted this revision.Nov 25 2021, 8:28 AM
This revision is now accepted and ready to land.Nov 25 2021, 8:28 AM