#include #include #include struct Leaf { }; struct Node; using TreeBase = boost::variant>; struct Tree : TreeBase { using TreeBase::TreeBase; template static Tree Create(Iter first, Iter last) { return Leaf{}; } }; struct Node { Tree left, right; }; int main() { std::string input{"abracadabra"}; const auto root = Tree::Create(begin(input), end(input)); }