L
LuB
Not sure why this won't compile ... Is 'DataTypeT' not visible to Base?
I'd like to pass a data type to a base class ... with the data type
visible via typedef in a derived class.
#include <iostream>
template<typename T>
struct Base
{
Base(typename T:ataTypeT b)
{
std::cout << "DataValue: " << b << std::endl;
}
};
struct Derived : public Base<Derived>
{
typedef int DataTypeT;
Derived(int d) : Base<Derived>(d) { }
};
int
main(int argc, char** argv)
{
Derived d(5);
return 0;
}
Thanks,
-Luther
I'd like to pass a data type to a base class ... with the data type
visible via typedef in a derived class.
#include <iostream>
template<typename T>
struct Base
{
Base(typename T:ataTypeT b)
{
std::cout << "DataValue: " << b << std::endl;
}
};
struct Derived : public Base<Derived>
{
typedef int DataTypeT;
Derived(int d) : Base<Derived>(d) { }
};
int
main(int argc, char** argv)
{
Derived d(5);
return 0;
}
Thanks,
-Luther