Technique: Recursive Variants and Boxes
foonathan.net
foonathan.net
#include <boost/variant/recursive_variant.hpp>
using Document = boost::make_recursive_variant<
std::string,
int64_t,
bool,
std::vector<boost::recursive_variant_>,
std::map<std::string, boost::recursive_variant_>
>::type;
Document d;
d = std::map<std::string, Document> {
{"name", "John"},
{"age", 36},
{"admin", true},
{"hobbies", std::vector<Document>
{"programming", "karate"}}
};Does the concept of a recursive array make sense to you? A recursive(ly typed) function? Or do you think such things can't exist? Like "[[[], []], []]" could be an instance of "mu X.[X]" right?
https://en.wikipedia.org/wiki/Recursive_data_type#Isorecursi...