Blender V5.0
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
11
12#include <iterator>
13
14#include "MEM_guardedalloc.h"
15
16namespace Freestyle {
17
18// use for iterators definitions
19template<class Element> class Nonconst_traits;
20
21template<class Element> class Const_traits {
22 public:
23 typedef Element value_type;
24 typedef const Element &reference;
25 typedef const Element *pointer;
26 typedef ptrdiff_t difference_type;
28
29 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Const_traits")
30};
31
32template<class Element> class Nonconst_traits {
33 public:
34 typedef Element value_type;
35 typedef Element &reference;
36 typedef Element *pointer;
37 typedef ptrdiff_t difference_type;
39
40 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Nonconst_traits")
41};
42
44 public:
45 typedef std::input_iterator_tag iterator_category;
46
47 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:InputIteratorTag_Traits")
48};
49
51 public:
52 typedef std::bidirectional_iterator_tag iterator_category;
53
54 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BidirectionalIteratorTag_Traits")
55};
56
57template<class Traits, class IteratorTagTraits> class IteratorBase {
58 public:
59 virtual ~IteratorBase() {}
60
61 virtual bool begin() const = 0;
62 virtual bool end() const = 0;
63
64 typedef typename IteratorTagTraits::iterator_category iterator_category;
65 typedef typename Traits::value_type value_type;
66 typedef typename Traits::difference_type difference_type;
67 typedef typename Traits::pointer pointer;
68 typedef typename Traits::reference reference;
69
70 protected:
72
73 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IteratorBase")
74};
75
76} /* 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
virtual bool begin() const =0
BidirectionalIteratorTag_Traits::iterator_category iterator_category
virtual bool end() const =0
Nonconst_traits< Element > Non_const_traits
inherits from class Rep
Definition AppCanvas.cpp:20