Skip to content

Commit

Permalink
Add operator[] to autovector::iterator_impl. (facebook#6047)
Browse files Browse the repository at this point in the history
Summary:
This is a required operator for random-access iterators, and an upcoming update for Visual Studio 2019 will change the C++ Standard Library's heap algorithms to use this operator.
Pull Request resolved: facebook#6047

Differential Revision: D18618531

Pulled By: ltamasi

fbshipit-source-id: 08d10bc85bf2dbc3f7ef0fa3c777e99f1e927ef5
  • Loading branch information
StephanTLavavej authored and facebook-github-bot committed Nov 20, 2019
1 parent 27ec3b3 commit 3cd7573
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions util/autovector.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ class autovector {
return &(*vect_)[index_];
}

reference operator[](difference_type len) {
return *(*this + len);
}

const_reference operator[](difference_type len) const {
return *(*this + len);
}


// -- Logical Operators
bool operator==(const self_type& other) const {
Expand Down

0 comments on commit 3cd7573

Please sign in to comment.