Boost logo

Boost :

Subject: Re: [boost] [BOOST CORE C++ Feature] the super or base keyword for C++
From: Marsh Ray (marsh_at_[hidden])
Date: 2011-05-02 18:58:06

What about:

template <
     size_t _Nb,
     base = _Base_bitset
         ((_Nb) < 1
         ? 0
         : ((_Nb) + numeric_limits<unsigned long>::digits - 1)
             / numeric_limits<unsigned long>::digits)
class bitset : base
     bitset(size_t n) : base(n) { }

Something like this compiles for me on G++4.6.0.

It has the disadvantage of changing the number and type of template
parameters, but we accept that for things like enable_if.

This has the advantage that the identifier 'base' is not inherited
accidentally into class scopes where it is no longer correct. Which is
something that always makes me uncomfortable with
the "typedef ... this_type" technique.

- Marsh

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