cvx
Loading...
Searching...
No Matches
bidirectional_iterator_cast.h
Go to the documentation of this file.
1#include "cvx/fallback.h"
2
3// clang-format off
4#ifndef INTERFACE
5#error "cvx/iter/bidirectional_iterator_cast.h requires INTERFACE to be defined (the struct name, e.g. #define INTERFACE my_iter)"
6#endif
7#ifndef IMPL_START
8#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_START to be defined"
9#endif
10#ifndef IMPL_END
11#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_END to be defined"
12#endif
13#ifndef IMPL_DROP
14#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_DROP to be defined"
15#endif
16#ifndef IMPL_AT_START
17#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_AT_START to be defined"
18#endif
19#ifndef IMPL_AT_END
20#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_AT_END to be defined"
21#endif
22#ifndef IMPL_COUNT
23#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_COUNT to be defined"
24#endif
25#ifndef IMPL_TO_START
26#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_TO_START to be defined"
27#endif
28#ifndef IMPL_TO_END
29#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_TO_END to be defined"
30#endif
31#ifndef IMPL_NEXT
32#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_NEXT to be defined"
33#endif
34#ifndef IMPL_PREV
35#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_PREV to be defined"
36#endif
37#ifndef IMPL_FORWARD
38#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_FORWARD to be defined"
39#endif
40#ifndef IMPL_BACKWARD
41#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_BACKWARD to be defined"
42#endif
43#ifndef IMPL_VALUE
44#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_VALUE to be defined"
45#endif
46#ifndef IMPL_INDEX
47#error "cvx/iter/bidirectional_iterator_cast.h requires IMPL_INDEX to be defined"
48#endif
49// clang-format on
50
51#include "cvx/core.h"
52
53struct VTABLE(INTERFACE) GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE) = {
54 .start = IMPL_START,
55 .end = IMPL_END,
56 .drop = IMPL_DROP,
57 .at_start = IMPL_AT_START,
58 .at_end = IMPL_AT_END,
59 .count = IMPL_COUNT,
60 .to_start = IMPL_TO_START,
61 .to_end = IMPL_TO_END,
62 .next = IMPL_NEXT,
63 .prev = IMPL_PREV,
64 .forward = IMPL_FORWARD,
65 .backward = IMPL_BACKWARD,
66 .value = IMPL_VALUE,
67 .index = IMPL_INDEX,
68};
69
70struct INTERFACE FUNC(CVX_(_iter_as_, INTERFACE))(cvx_container *instance)
71{
72 return (struct INTERFACE){
73 .vtable = &GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE),
74 .instance = instance,
75 };
76}
77
78#undef INTERFACE
#define CVX_(A, B)
Definition core.h:10
#define GLOBAL_VTABLE(SNAME, X, NAME)
Definition core.h:13
Definition deque.h:30
struct INTERFACE_vtable * vtable
Definition deque.h:32
Definition binary_heap.h:135