Vita
value.h
Go to the documentation of this file.
1
13#if !defined(VITA_VALUE_H)
14#define VITA_VALUE_H
15
16#include <iosfwd>
17#include <string>
18#include <variant>
19
20namespace vita
21{
22
34enum domain_t {d_void = 0, d_int, d_double, d_string};
35
36using D_VOID = std::monostate;
37using D_INT = int;
38using D_DOUBLE = double;
39using D_STRING = std::string;
40
45using value_t = std::variant<D_VOID, D_INT, D_DOUBLE, D_STRING>;
46
51inline bool has_value(const value_t &v)
52{
53 return !std::holds_alternative<std::monostate>(v);
54}
55
56std::ostream &operator<<(std::ostream &, const value_t &);
57
58} // namespace vita
59
60#endif // include guard
The main namespace for the project.
bool has_value(const value_t &v)
Definition: value.h:51
domain_t
In an environment where a symbol such as '+' may have many different meanings, it's useful to specify...
Definition: value.h:34
std::ostream & operator<<(std::ostream &o, hash_t h)
Mainly useful for debugging / testing.
Definition: cache_hash.cc:56
std::variant< D_VOID, D_INT, D_DOUBLE, D_STRING > value_t
A variant containing the data types used by the interpreter for internal calculations / output value ...
Definition: value.h:45