|
|
|
|
|
|
|
|
|
|
class
node {
|
|
|
public:
enum Tag { I, P };
|
|
|
private:
|
|
|
union { int i; node * p; };
|
|
|
Tag tag;
|
|
|
void check(Tag t){ if (tag!=t) error();}
|
|
node * next;
|
|
|
public:
|
|
|
Tag get_tag() { return tag; }
|
|
|
int & ival() { check(I); return i; }
|
|
node * & pval() { check(P); return p;
}
|
|