add src/coders/obj

This commit is contained in:
MihailRis
2024-06-22 20:24:35 +03:00
parent a9640fff36
commit e4f9bd03b7
11 changed files with 241 additions and 28 deletions
+10
View File
@@ -3,6 +3,7 @@
#include "../typedefs.hpp"
#include <cmath>
#include <string>
#include <vector>
#include <memory>
@@ -47,6 +48,15 @@ namespace dynamic {
std::holds_alternative<integer_t>(value);
}
inline number_t as_number(const Value& value) {
if (auto num = std::get_if<number_t>(&value)) {
return *num;
} else if (auto num = std::get_if<integer_t>(&value)) {
return *num;
}
return NAN;
}
class List {
public:
std::vector<Value> values;