cvx
Loading...
Searching...
No Matches
stack.h
Go to the documentation of this file.
1#include "cvx/fallback.h"
2
3// clang-format off
4#ifndef V
5#error "cvx/interface/stack.h requires V to be defined (the element type, e.g. #define V int)"
6#endif
7#ifndef INTERFACE
8#error "cvx/interface/stack.h requires INTERFACE to be defined (the struct name, e.g. #define INTERFACE my_stack)"
9#endif
10// clang-format on
11
12#include "cvx/core.h"
13
14struct VTABLE(INTERFACE)
15{
16 // constructors and destructors
17 void (*clone)(cvx_container *, cvx_container *);
18 void (*drop)(cvx_container *);
19 // operations
20 void (*push)(cvx_container *, V);
21 V (*pop)(cvx_container *);
22 V (*peek)(cvx_container *);
23 V (*replace)(cvx_container *, V);
24 // state
25 size_t (*count)(cvx_container *);
26};
27
28struct INTERFACE
29{
30 cvx_container *instance;
31 struct VTABLE(INTERFACE) * vtable;
32};
33
34#undef INTERFACE
Definition deque.h:30
Definition binary_heap.h:135