template <typename T>
struct TemplatedStruct
{
T value;
};
std::vector<TemplatedStruct*> VectorOfTemplatedStructs;
Now, when I want to add a TemaplatedStruct to the vector, I am doing it like this:
// Add item with different type depending on the case
switch (theCase)
{
case CaseNumOne:
AddSettng<bool>(someValue);
break;
case CaseNumTwo:
AddSettng<int>(someValue);
...
}
// Add an item
template <typename ValType>
void AddSettng(ValType val)
{
// Insert into VectorOfTemplatedStructs
TemplatedStruct<ValType>* NewEntry = new TemplatedStruct<ValType>(val);
VectorOfTemplatedStructs.push_back(NewEntry); // !! Here's the error
}
On the line where I push the the TemplatedStruct onto the vector, the compiler (VC++ 2003) complains that it can't convert my 'TemplatedStruct