Using CRTP sometimes I write a code like this:
// this was written first
struct Foo : Base<Foo, ...>
{
...
};
// this was copy-pasted from Foo some days later
struct Bar : Base<Foo, ...>
{
...
};
And it's very difficult to understand what goes wrong, until I trace code in debugger and see that Bar's members aren't used in Base
.
How to reveal this error at compile time?
(I use MSVC2010, so I can use some C++0x features and MSVC language extensions)