
On Thu, Oct 28, 2010 at 1:43 AM, David Brownstein <dbrownstein@intrix.com>wrote:
Doesn't this declaration ("template<> struct map_index< 0 > {};") create an object that derives from map_index<-1> (except of course this is of unsigned type, so it is really std::numeric_limits<unsigned>::max())? Was this intended, as it exceeds (greatly!) the limit top_index?
That line won't create an object that derives from map_index<-1>, it's a template specialization as a terminating case so that map_index<0> doesn't inherit from anything. It's there specifically to avoid the problem you are describing. The code should work in GCC if you want to play around with it, though you'll have to use some imagination since it's just an example that the technique works. I should have probably put together an example with the iterator concepts related by inheritance to bring it a little bit closer to a practical setting, but I think you get the gist. -- -Matt Calabrese