cvx
Loading...
Searching...
No Matches
forward_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/forward_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/forward_iterator_cast.h requires IMPL_START to be defined"
9#endif
10#ifndef IMPL_DROP
11#error "cvx/iter/forward_iterator_cast.h requires IMPL_DROP to be defined"
12#endif
13#ifndef IMPL_AT_START
14#error "cvx/iter/forward_iterator_cast.h requires IMPL_AT_START to be defined"
15#endif
16#ifndef IMPL_AT_END
17#error "cvx/iter/forward_iterator_cast.h requires IMPL_AT_END to be defined"
18#endif
19#ifndef IMPL_COUNT
20#error "cvx/iter/forward_iterator_cast.h requires IMPL_COUNT to be defined"
21#endif
22#ifndef IMPL_TO_START
23#error "cvx/iter/forward_iterator_cast.h requires IMPL_TO_START to be defined"
24#endif
25#ifndef IMPL_NEXT
26#error "cvx/iter/forward_iterator_cast.h requires IMPL_NEXT to be defined"
27#endif
28#ifndef IMPL_FORWARD
29#error "cvx/iter/forward_iterator_cast.h requires IMPL_FORWARD to be defined"
30#endif
31#ifndef IMPL_VALUE
32#error "cvx/iter/forward_iterator_cast.h requires IMPL_VALUE to be defined"
33#endif
34#ifndef IMPL_INDEX
35#error "cvx/iter/forward_iterator_cast.h requires IMPL_INDEX to be defined"
36#endif
37// clang-format on
38
39#include "cvx/core.h"
40
41struct VTABLE(INTERFACE) GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE) = {
42 .start = IMPL_START,
43 .drop = IMPL_DROP,
44 .at_start = IMPL_AT_START,
45 .at_end = IMPL_AT_END,
46 .count = IMPL_COUNT,
47 .to_start = IMPL_TO_START,
48 .next = IMPL_NEXT,
49 .forward = IMPL_FORWARD,
50 .value = IMPL_VALUE,
51 .index = IMPL_INDEX,
52};
53
54struct INTERFACE FUNC(CVX_(_iter_as_, INTERFACE))(cvx_container *instance)
55{
56 return (struct INTERFACE){
57 .vtable = &GLOBAL_VTABLE(SNAME, _iter_as_, INTERFACE),
58 .instance = instance,
59 };
60}
61
62#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