DUNE PDELab (git)

dummyiterator.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_COMMON_DUMMYITERATOR_HH
6#define DUNE_COMMON_DUMMYITERATOR_HH
7
8#include <cstddef>
9#include <type_traits>
10
12
13template<typename T>
14class dummyiterator
15 : public Dune::BidirectionalIteratorFacade<dummyiterator<T>, T, T&,
16 std::ptrdiff_t>
17{
18 friend class dummyiterator<const typename std::remove_const<T>::type>;
19
20 T *value;
21
22public:
23 dummyiterator(T& value_)
24 : value(&value_)
25 {}
26
27 template<typename T2>
28 dummyiterator
29 ( const dummyiterator<T2>& o,
30 typename std::enable_if<std::is_convertible<T2&, T&>::value>::type* = 0)
31 : value(o.value)
32 {}
33
34 T& dereference() const {
35 return *value;
36 }
37
38 bool equals(const dummyiterator& o) const {
39 return value == o.value;
40 }
41
42 void increment() {}
43 void decrement() {}
44};
45
46#endif // DUNE_COMMON_DUMMYITERATOR_HH
Facade class for stl conformant bidirectional iterators.
Definition: iteratorfacades.hh:275
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition: hybridutilities.hh:587
This file implements iterator facade classes for writing stl conformant iterators.
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)