Generic container for objects of a discriminated type