Ticket #12680: crash.cc

File crash.cc, 473 bytes (added by djh, 6 years ago)
Line 
1#include <string>
2#include <iterator>
3
4#include <boost/variant.hpp>
5
6
7struct Leaf { };
8struct Node;
9
10using TreeBase = boost::variant<Leaf, boost::recursive_wrapper<Node>>;
11
12struct Tree : TreeBase {
13 using TreeBase::TreeBase;
14
15 template <typename Iter>
16 static Tree Create(Iter first, Iter last) { return Leaf{}; }
17};
18
19
20struct Node {
21 Tree left, right;
22};
23
24
25int main() {
26 std::string input{"abracadabra"};
27
28 const auto root = Tree::Create(begin(input), end(input));
29}