This is an archive of the discontinued LLVM Phabricator instance.

[ADT] use is_base_of inplace of is_same for random_access_iterator_tag checks
ClosedPublic

Authored by njames93 on Jul 20 2020, 1:19 AM.

Details

Summary

Replace std::is_same<X, std::random_access_iterator_tag> with std::is_base_of<std::random_access_iterator_tag, X> in STLExtra algos.

This doesn't have too much impact on LLVM internally as no structs derive from it.
However external projects embedding LLVM may use std::contiguous_iterator_tag which should be considered by these algorithms.
As well as any other potential tags people want to define derived from std::random_access_iterator_tag

Diff Detail

Event Timeline

njames93 created this revision.Jul 20 2020, 1:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2020, 1:19 AM
dblaikie accepted this revision.Jul 20 2020, 1:51 PM

Fair enough - might be nice to have a test case? But may not be worth it.

This revision is now accepted and ready to land.Jul 20 2020, 1:51 PM

Fair enough - might be nice to have a test case? But may not be worth it.

I'm not sure a test case would be worth it as this is purely a compile time check.

This revision was automatically updated to reflect the committed changes.