Boost logo

Boost :

Subject: Re: [boost] Call for interest - BOOST_AUTO_FUNCTION
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-10-28 01:58:45

On Thu, Oct 28, 2010 at 1:43 AM, David Brownstein <dbrownstein_at_[hidden]>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

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at