I have an expression tree in which the nodes are operators (union, intersection etc represented by a string "/u") or the nodes are std::sets.

How could I access the std::set's values in order to carry out the tree evaluation using the operator functions(set_union(), set_intersection() etc) ? The expressions are pre and postfix.

Thanks for any help, it's most appreciated.

Edited by Carrots: n/a

6 Years
Discussion Span
Last Post by arkoenig

Thanks for your help, so you think I should implement my tree_evaluation() function to iterate through the sets, and return the values held to the set_union(), set_intersection() functions?

Thanks for giving me direction with this. I'm new to trees in general. :)


Well... set_union and set_intersection are really intended to let you do set operations on sorted vectors. Curiously, they don't work if the destination is an actual set. So you have to implement those operations yourself using insert and erase, which, fortunately, aren't particularly different operations.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.