With Boost Spirit you can write expressions akin to EBNF in your C++ code. The downsides are compile times (improved in the new version) and difficult to parse error messages at compile time.<p>If you stick to your code you should at least:<p>* add a copy constructor or delete it explicitly<p>* pass in the vector as unique_ptr to the constructor. This way the &quot;takes ownership&quot; will be clear without the need of a comment.<p>* add your missing includes e.g. vector<p>* stop using _ as variable prefix, it&#x27;s forbidden<p>* throw from the constructor, don&#x27;t exit<p>Boost variant + boost vector will allow you to eliminate all the manual memory management (boost vector allows incomplete types).