Blender V4.3
BaseIterator.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include <iterator>
13
14#ifdef WITH_CXX_GUARDEDALLOC
15# include "MEM_guardedalloc.h"
16#endif
17
18namespace Freestyle {
19
20// use for iterators definitions
21template<class Element> class Nonconst_traits;
22
23template<class Element> class Const_traits {
24 public:
25 typedef Element value_type;
26 typedef const Element &reference;
27 typedef const Element *pointer;
28 typedef ptrdiff_t difference_type;
30
31#ifdef WITH_CXX_GUARDEDALLOC
32 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Const_traits")
33#endif
34};
35
36template<class Element> class Nonconst_traits {
37 public:
38 typedef Element value_type;
39 typedef Element &reference;
40 typedef Element *pointer;
41 typedef ptrdiff_t difference_type;
43
44#ifdef WITH_CXX_GUARDEDALLOC
45 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Nonconst_traits")
46#endif
47};
48
50 public:
51 typedef std::input_iterator_tag iterator_category;
52
53#ifdef WITH_CXX_GUARDEDALLOC
54 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:InputIteratorTag_Traits")
55#endif
56};
57
59 public:
60 typedef std::bidirectional_iterator_tag iterator_category;
61
62#ifdef WITH_CXX_GUARDEDALLOC
63 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BidirectionalIteratorTag_Traits")
64#endif
65};
66
67template<class Traits, class IteratorTagTraits> class IteratorBase {
68 public:
69 virtual ~IteratorBase() {}
70
71 virtual bool begin() const = 0;
72 virtual bool end() const = 0;
73
74 typedef typename IteratorTagTraits::iterator_category iterator_category;
75 typedef typename Traits::value_type value_type;
76 typedef typename Traits::difference_type difference_type;
77 typedef typename Traits::pointer pointer;
78 typedef typename Traits::reference reference;
79
80 protected:
82
83#ifdef WITH_CXX_GUARDEDALLOC
84 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IteratorBase")
85#endif
86};
87
88} /* namespace Freestyle */
Read Guarded memory(de)allocation.
std::bidirectional_iterator_tag iterator_category
const Element & reference
Nonconst_traits< Element > Non_const_traits
const Element * pointer
std::input_iterator_tag iterator_category
Traits::difference_type difference_type
Traits::reference reference
virtual bool begin() const =0
IteratorTagTraits::iterator_category iterator_category
Traits::value_type value_type
Traits::pointer pointer
virtual bool end() const =0
Nonconst_traits< Element > Non_const_traits
inherits from class Rep
Definition AppCanvas.cpp:20