/*
- * Copyright 2017-present Facebook, Inc.
+ * Copyright 2016-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* For example:
*
- * for (auto it : folly::enumerate(vec)) {
+ * for (auto&& it : folly::enumerate(vec)) {
* // *it is a reference to the current element. Const if vec is const.
* // it->member can be used as well.
* // it.index contains the iteration count.
*
* If the iteration variable is const, the reference is too.
*
- * for (const auto it : folly::enumerate(vec)) {
+ * for (const auto&& it : folly::enumerate(vec)) {
* // *it is always a const reference.
* }
*
}
template <typename OtherIterator>
- FOLLY_ALWAYS_INLINE bool operator==(const Enumerator<OtherIterator>& rhs) {
+ FOLLY_ALWAYS_INLINE bool operator==(
+ const Enumerator<OtherIterator>& rhs) const {
return it_ == rhs.it_;
}
template <typename OtherIterator>
- FOLLY_ALWAYS_INLINE bool operator!=(const Enumerator<OtherIterator>& rhs) {
+ FOLLY_ALWAYS_INLINE bool operator!=(
+ const Enumerator<OtherIterator>& rhs) const {
return !(it_ == rhs.it_);
}