Suppose I am writing a compiler for some programming language. An abstract syntax tree (AST) is used as the internal representation. I can see two possible ways to develop it:
- via
boost::variant - using inheritance
Since the hierarchy of nodes is fixed, it boost::variantwill be enough.
My question is, what are the advantages and disadvantages of each approach from the points of health and efficiency of execution?
source
share