I'm using g++ v3.4.1.
I'm considering using an anonymous union in the following fashion:
class SomeClass { .... private: bool isPseudo_; union { LayoutVertex *layoutVertex_; PseudoVertex *pseudoVertex_; }; }
Both LayoutVertex and PseudoVertex have the same methods.
Only in the constructors of SomeClass will I have to code in a way that differenciates between layoutVertex_ and psuedoVertex_.
My question is can I safely use layoutVertex_ elsewhere even if its initialized with a PsuedoVertex object?