cvx
Loading...
Searching...
No Matches
random_access_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/random_access_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/random_access_iterator_cast.h requires IMPL_START to be defined"
9#endif
10#ifndef IMPL_END
11#error "cvx/iter/random_access_iterator_cast.h requires IMPL_END to be defined"
12#endif
13#ifndef IMPL_DROP
14#error "cvx/iter/random_access_iterator_cast.h requires IMPL_DROP to be defined"
15#endif
16#ifndef IMPL_AT_START
17#error "cvx/iter/random_access_iterator_cast.h requires IMPL_AT_START to be defined"
18#endif
19#ifndef IMPL_AT_END
20#error "cvx/iter/random_access_iterator_cast.h requires IMPL_AT_END to be defined"
21#endif
22#ifndef IMPL_COUNT
23#error "cvx/iter/random_access_iterator_cast.h requires IMPL_COUNT to be defined"
24#endif
25#ifndef IMPL_TO_START
26#error "cvx/iter/random_access_iterator_cast.h requires IMPL_TO_START to be defined"
27#endif
28#ifndef IMPL_TO_END
29#error "cvx/iter/random_access_iterator_cast.h requires IMPL_TO_END to be defined"
30#endif
31#ifndef IMPL_NEXT
32#error "cvx/iter/random_access_iterator_cast.h requires IMPL_NEXT to be defined"
33#endif
34#ifndef IMPL_PREV
35#error "cvx/iter/random_access_iterator_cast.h requires IMPL_PREV to be defined"
36#endif
37#ifndef IMPL_FORWARD
38#error "cvx/iter/random_access_iterator_cast.h requires IMPL_FORWARD to be defined"
39#endif
40#ifndef IMPL_BACKWARD
41#error "cvx/iter/random_access_iterator_cast.h requires IMPL_BACKWARD to be defined"
42#endif
43#ifndef IMPL_GO_TO
44#error "cvx/iter/random_access_iterator_cast.h requires IMPL_GO_TO to be defined"
45#endif
46#ifndef IMPL_VALUE
47#error "cvx/iter/random_access_iterator_cast.h requires IMPL_VALUE to be defined"
48#endif
49#ifndef IMPL_INDEX
50#error "cvx/iter/random_access_iterator_cast.h requires IMPL_INDEX to be defined"
51#endif
52// clang-format on
53
54#include "cvx/core.h"
55
56struct VTABLE(INTERFACE) GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE) = {
57 .start = IMPL_START,
58 .end = IMPL_END,
59 .drop = IMPL_DROP,
60 .at_start = IMPL_AT_START,
61 .at_end = IMPL_AT_END,
62 .count = IMPL_COUNT,
63 .to_start = IMPL_TO_START,
64 .to_end = IMPL_TO_END,
65 .next = IMPL_NEXT,
66 .prev = IMPL_PREV,
67 .forward = IMPL_FORWARD,
68 .backward = IMPL_BACKWARD,
69 .go_to = IMPL_GO_TO,
70 .value = IMPL_VALUE,
71 .index = IMPL_INDEX,
72};
73
74struct INTERFACE FUNC(CVX_(_iter_as_, INTERFACE))(cvx_container *instance)
75{
76 return (struct INTERFACE){
77 .vtable = &GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE),
78 .instance = instance,
79 };
80}
81
82#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