This is an archive of the discontinued LLVM Phabricator instance.

Make __wrap_iter constexpr
Needs ReviewPublic

Authored by mclow.lists on May 25 2017, 7:28 AM.

Details

Reviewers
EricWF
Summary

__wrap_iter is an internal libc++ class that is used as an iterator type when (for some reason) we don't want to use raw pointers as an iterator. It is the iterator type for vector and string (but not array - not sure why). If we used pointers, all the operations on the iterators would be constexpr. With this patch, the corresponding operations on __wrap_iter are constexpr as well.

We'll have to do this when http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2938 is adopted.

No tests, because all the interesting constructors of __wrap_iter are private, and only accessed through friend functions.
I have written tests (after making the appropriate ctors public) and they seem to work.

Diff Detail

Event Timeline

mclow.lists created this revision.May 25 2017, 7:28 AM
mclow.lists added inline comments.
include/iterator
1409

This is testing debris - making the constructors public for testing.

EricWF edited edge metadata.May 25 2017, 11:40 AM

@mclow.lists Could you update this diff with more context?