edit: I\'ll put a github link here when I am done altering my design for anyone who is interested.
Background
I\'m replacing a
Extending @jpalecek's idea, we could make that template argument take a default argument. But you need to enable C++0x to get this
#include
#include
template
class base
{
public:
template // <-- (requires C++0x to have a default)
void foo(typename X::dummy& d)
{
printf("%s\n", typeid(d).name());
}
};
template
class derived
: public base< derived >
{
public:
typedef DUMMY dummy;
};
struct tag{};
int main()
{
derived foo;
tag t;
foo.foo(t); // <--- call the function like normal.
}
http://ideone.com/AXXdW