Lunchbox
1.6.0
|
00001 00002 /* Copyright (c) 2011-2012, EPFL/Blue Brain Project 00003 * Stefan Eilemann <stefan.eilemann@epfl.ch> 00004 * 00005 * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox> 00006 * 00007 * This library is free software; you can redistribute it and/or modify it under 00008 * the terms of the GNU Lesser General Public License version 3.0 as published 00009 * by the Free Software Foundation. 00010 * 00011 * This library is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00014 * details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this library; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #ifndef LUNCHBOX_LFVECTOR_ITERATOR_H 00022 #define LUNCHBOX_LFVECTOR_ITERATOR_H 00023 00024 #include <lunchbox/indexIterator.h> 00025 00026 namespace lunchbox 00027 { 00028 00029 template< class V, class T > 00030 class LFVectorIterator : public IndexIterator< LFVectorIterator< V, T >, V, T > 00031 { 00032 typedef IndexIterator< LFVectorIterator< V, T >, V, T > Super; 00033 00034 public: 00035 LFVectorIterator() : Super( 0, 0 ) {} 00036 LFVectorIterator( V* vector, size_t i ) : Super( vector, i ) {} 00037 template< class U, class W > 00038 LFVectorIterator( const LFVectorIterator< U, W >& from ) : Super( from ) {} 00039 00040 T& operator*() const { return (*Super::container_)[ Super::i_ ]; } 00041 T* operator->() const { return &(*Super::container_)[ Super::i_ ]; } 00042 T& operator[]( const size_t& n ) const 00043 { return (*Super::container_)[ Super::i_ + n ]; } 00044 00045 private: 00046 template< class, int32_t > friend class LFVector; // LFVector::erase 00047 }; 00048 00049 } 00050 00051 #endif // LUNCHBOX_LFVECTOR_ITERATOR_H