I'm working on a parser for RDDL and, as I've done it before, when I define union which contains types I use, I use pointers. E.g.
You don't have to use pointers. As you can see, neither
int are pointers.
As to "why do we use" part then, we should remember some properties of
sizeof union_t must be at least as big as the biggest member. So you don't want union with a single word
int and some 1KB class by value. And pointer almost always have fixed small size.
In C++ world, many classes (for your example,
std::vector) have non-trivial copy constructors and destructors. For such classes, it is unsafe to put them in union (standard forbids it, as far as I know, but some compilers allow).