D
Dick Bridges
I'm still struggling with templates [and mpl?]. If someone could point me
toward books or articles or tutorials that discuss how to achieve the
following, I'd very much appreciate it.
I'd like to create a traits template [MyClsTraits] to be used by some class
[MyCls]. For example, suppose I've inherited (i.e., have no control over)
the following #defineS.
#define X_ONE 1
#define X_TWO 2
#define Y_ONE 1
#define Y_TWO 2
And I'd like to be able to declare an instance like this.
MyClsTraits<X_TWO, Y_ONE> t;
such that t has two traits: X_ and Y_ that are then used by MyCls<t>.
Additionally, I need to be able to control the allowable combinations. IOW:
X_TWO/Y_ONE is legal but X_ONE/Y_TWO is not a valid combination and produces
a compilation or link error.
TIA Any relevant references would be appreciated.
toward books or articles or tutorials that discuss how to achieve the
following, I'd very much appreciate it.
I'd like to create a traits template [MyClsTraits] to be used by some class
[MyCls]. For example, suppose I've inherited (i.e., have no control over)
the following #defineS.
#define X_ONE 1
#define X_TWO 2
#define Y_ONE 1
#define Y_TWO 2
And I'd like to be able to declare an instance like this.
MyClsTraits<X_TWO, Y_ONE> t;
such that t has two traits: X_ and Y_ that are then used by MyCls<t>.
Additionally, I need to be able to control the allowable combinations. IOW:
X_TWO/Y_ONE is legal but X_ONE/Y_TWO is not a valid combination and produces
a compilation or link error.
TIA Any relevant references would be appreciated.