/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* An iterator that acts like another iterator, but iterating in * the negative direction. (Note that not all iterators can iterate
* in the negative direction.) */
// This should only be used in cases where std::reverse_iterator cannot be used, // because the underlying iterator is not a proper bidirectional iterator, but // rather, e.g., a stashing iterator such as IntegerIterator. It is less // efficient than std::reverse_iterator for proper bidirectional iterators. template <typename IteratorT> class ReverseIterator { public: using value_type = typename IteratorT::value_type; using pointer = typename IteratorT::pointer; using reference = typename IteratorT::reference; using difference_type = typename IteratorT::difference_type; using iterator_category = typename IteratorT::iterator_category;
// The return type is not reference, but rather the return type of // Iterator::operator*(), which might be value_type, to allow this to work // with stashing iterators such as IntegerIterator, see also Bug 1175485.
decltype(*std::declval<IteratorT>()) operator*() const {
IteratorT tmp = mCurrent; return *--tmp;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.