Hello fellow coders,

I am trying to create a template that behaves differently

if it is give a primative type vs a class. I should be easy

enough but my brain seems to be stuck in neutral.

Here is the general problem:

Here are the requirements.Code:template< classT, classS> struct Node { Node* MyNode;TValue; } template< classT, classS> class Myclass {TGetValue(); bool operator== (Trhs); Node node; } // In the case that T is a class, T will look somethink like this. template< classT, classS> class MyVector { int size; float length;Svalue; }

IfT is a a primative(int, long, float, double, char...), S will be a primative of the same type

GetValuewill return the value ofclassInst1.node.value

Theoperator==will compareclassInst1.node.value == classInst2.node.value

IfT is a class, S will be a primative.

GetValuewill return the value ofclassInst1.node.value

Theoperator==will compareclassInst1.node.<T>value.value == classInst2.node.<T>value.value

so I could have a program like this:

Thank in advance for any help.Code:main() { Myclass<int, int> Foo1; Myclass<int, int> Foo2; Myclass<MyVector, float> Bar1; Myclass<MyVector, float> Bar2; int myInt = Foo1.GetValue(); //returns Foo1.node.value MyVector myVect = Bar1.GetValue(); //returns Bar1.node.value if ( Foo1 == Foo2 ){} //compares Foo1.node.value == Foo2.node.value if ( Bar1 == Bar2 ){} //compares Bar1.node.value.value == Bar2.node.value.value }

byteherder