27#include <boost/serialization/serialization.hpp>
28#include <boost/serialization/string.hpp>
29#include <boost/serialization/variant.hpp>
30#include <boost/serialization/vector.hpp>
31#include <boost/variant.hpp>
37#include <unordered_map>
61using Variant = boost::make_recursive_variant<
65 std::vector<boost::recursive_variant_>,
66 std::unordered_map<int, boost::recursive_variant_>,
67 std::unordered_map<std::string, boost::recursive_variant_>>::type;
69using VariantMap = std::unordered_map<std::string, Variant>;
79template <
typename K,
typename V>
81 std::unordered_map<K, Variant> ret;
82 for (
auto const &it : v) {
83 ret.insert({it.first,
Variant(it.second)});
89 std::vector<Variant> ret;
90 for (
auto const &item : v) {
91 ret.emplace_back(item);
97template <
class T>
struct is_type_visitor : boost::static_visitor<bool> {
98 template <
class U>
constexpr bool operator()(
const U &)
const {
99 return std::is_same_v<T, U>;
112 return boost::apply_visitor(detail::is_type_visitor<T>(), v);
Vector implementation and trait types for boost qvm interoperability.
Type to indicate no value in Variant.
bool is_type(Variant const &v)
Check is a Variant holds a specific type.
std::shared_ptr< ObjectHandle > ObjectRef
std::unordered_map< std::string, Variant > VariantMap
auto make_unordered_map_of_variants(std::unordered_map< K, V > const &v)
Variant make_variant(const T &x)
Make a Variant from argument.
auto make_vector_of_variants(std::vector< T > const &v)
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.
bool is_none(Variant const &v)
constexpr const None none
None-"literal".
Utils::Vector< bool, 3 > Vector3b