cvx
Loading...
Searching...
No Matches
forward_iterator.h
Go to the documentation of this file.
1#include "cvx/fallback.h"
2
3// clang-format off
4#ifndef V
5#error "cvx/iter/forward_iterator.h requires V to be defined (the element type, e.g. #define V int)"
6#endif
7#ifndef INTERFACE
8#error "cvx/iter/forward_iterator.h requires INTERFACE to be defined (the struct name, e.g. #define INTERFACE my_iter)"
9#endif
10// clang-format on
11
12#include "cvx/core.h"
13
14struct VTABLE(INTERFACE)
15{
16 // constructors and destructors
17 cvx_container *(*start)(cvx_container *);
18 void (*drop)(cvx_container *);
19 // state
20 bool (*at_start)(cvx_container *);
21 bool (*at_end)(cvx_container *);
22 size_t (*count)(cvx_container *);
23 // movement
24 void (*to_start)(cvx_container *);
25 void (*next)(cvx_container *);
26 void (*forward)(cvx_container *, size_t steps);
27 // access
28 V (*value)(cvx_container *);
29 size_t (*index)(cvx_container *);
30};
31
32struct INTERFACE
33{
34 cvx_container *instance;
35 struct VTABLE(INTERFACE) * vtable;
36};
37
38#undef INTERFACE
Definition deque.h:30
Definition binary_heap.h:135