DUNE-FEM (unstable)

iteratorfacadetest.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_ITERATORFACADETEST_HH
6#define DUNE_ITERATORFACADETEST_HH
10
11template<class T,
12 template<class,class,class,class> class IteratorFacade=Dune::RandomAccessIteratorFacade>
13class TestContainer {
14public:
15 typedef Dune::GenericIterator<TestContainer<T,IteratorFacade>,T,T&,std::ptrdiff_t,IteratorFacade> iterator;
16
17 typedef Dune::GenericIterator<const TestContainer<T,IteratorFacade>,const T,const T&,std::ptrdiff_t,IteratorFacade> const_iterator;
18
19 TestContainer(){
20 for(int i=0; i < 100; i++)
21 values_[i]=i;
22 }
23
24 iterator begin(){
25 return iterator(*this, 0);
26 }
27
28 const_iterator begin() const {
29 return const_iterator(*this, 0);
30 }
31
32 iterator end(){
33 return iterator(*this, 100);
34 }
35
36 const_iterator end() const {
37 return const_iterator(*this, 100);
38 }
39
40 T& operator[](int i){
41 return values_[i];
42 }
43
44
45 const T& operator[](int i) const {
46 return values_[i];
47 }
48private:
49 T values_[100];
50};
51
52#endif
Generic class for stl-conforming iterators for container classes with operator[].
Definition: genericiterator.hh:153
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:435
Implements a generic iterator class for writing stl conformant iterators.
This file implements iterator facade classes for writing stl conformant iterators.
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)