S
Susan Baker
Hi,
I want to store data in a 3-tuple {a,b,c}.
Element a is an enumeration, and element c is an enumeration which is
specific (i.e. determined) by a.
An example will help clarify further. I give two examples, one of a
valid instance, and the other, an invalid instance.
typedef enum { bovine, gamebird, seafood } general_meat ;
Note: each of the elements above is a category of its own. I can
further partition the seafood category to yield the following grouping:
typedef enum { scallops, lobster, cod, prawn, salmon} seafood ;
class Meal {
general_meat m ;
bool cook_first ;
X data_type_that_will_accept_specific_types_of_general_meat_m ;
}
I hope the illustration above provides some illumination on the problem.
class Meal will (obviously?) have to be a template class - but I
don't know how to enforce X to be a subset (i.e. a permissable type)
determined by m.
I look forward to any ideas for a possible solution. Thanks
I want to store data in a 3-tuple {a,b,c}.
Element a is an enumeration, and element c is an enumeration which is
specific (i.e. determined) by a.
An example will help clarify further. I give two examples, one of a
valid instance, and the other, an invalid instance.
typedef enum { bovine, gamebird, seafood } general_meat ;
Note: each of the elements above is a category of its own. I can
further partition the seafood category to yield the following grouping:
typedef enum { scallops, lobster, cod, prawn, salmon} seafood ;
class Meal {
general_meat m ;
bool cook_first ;
X data_type_that_will_accept_specific_types_of_general_meat_m ;
}
I hope the illustration above provides some illumination on the problem.
class Meal will (obviously?) have to be a template class - but I
don't know how to enforce X to be a subset (i.e. a permissable type)
determined by m.
I look forward to any ideas for a possible solution. Thanks