[C++-sig] Re: indexing_v2 status update

Joel de Guzman joel at boost-consulting.com
Thu Jan 22 01:16:29 CET 2004


Raoul Gough wrote:

> This is how the new implementation is actually looking:
> 
>   template<
>       class Container,
>       unsigned int MethodMask = all_methods,  // All supported by algorithms
>       class Algorithms = algorithms<Container>
>   >
>   struct container_suite /* ... */;
> 
> The second template parameter is an unsigned bitmask that gets
> combined with a "supported_methods" value provided by the Algorithms
> argument. It worked out this way because determining what features
> should be supported by default depends on the value type as well as
> the type of container (i.e. it needs to know equality_comparable and
> less_than_comparable from the value_traits template).

[snips]

> I've tested this much under gcc 3.3.1 and MSVC6.0 and 7.1. So before I
> get too carried away and convert everything to this new style, does
> Dave, Joel, or anyone else have comments or suggestions?

Looks cool to me ;-) My only concern is: what if the bits of an
unsigned int runs out? Unlikely? What if the methods identifiers
are types instead in a special namespace and specifying the
methods is done using an mpl typelist? Example:

container_suite<C, mpl::list<method_len, method_getitem, method_getitem_slice> >

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net




More information about the Cplusplus-sig mailing list