一呼百應, "one call, a hundred responses"
Loading...
Searching...
No Matches
typestate.hpp
Go to the documentation of this file.
1#pragma once
2
13#include "common.hpp"
14
24
35#if ein_has_attribute(consumable)
36 #define ein_consumable(__x) __attribute__((consumable(__x)))
37#else
38 #define ein_consumable(__x)
39#endif
40
49#if ein_has_attribute(callable_when)
50 #define ein_callable_when(...) __attribute__((callable_when(__VA_ARGS__)))
51#else
52 #define ein_callable_when(...)
53#endif
54
64#if ein_has_attribute(param_typestate)
65 #define ein_param_typestate(...) __attribute__((param_typestate(__VA_ARGS__)))
66#else
67 #define ein_param_typestate(...)
68#endif
69
85#if ein_has_attribute(return_typestate)
86 #define ein_return_typestate(...) __attribute__((return_typestate(__VA_ARGS__)))
87#else
88 #define ein_return_typestate(...)
89#endif
90
100#define ein_moving ein_return_typestate("consumed") ein_param_typestate("unconsumed")
101
110#if ein_has_attribute(set_typestate)
111 #define ein_set_typestate(...) __attribute__((set_typestate(__VA_ARGS__)))
112#else
113 #define ein_set_typestate(...)
114#endif
115
124#if ein_has_attribute(test_typestate)
125 #define ein_test_typestate(...) __attribute__((test_typestate(__VA_ARGS__)))
126#else
127 #define ein_test_typestate
128 #define ein_test_typestate(...)
129#endif // ein_has_attribute(test_typestate)
130