Boost logo

Boost :

Subject: Re: [boost] [BOOST CORE C++ Feature] the super or base keyword for C++
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-05-02 17:58:42


Den 02-05-2011 23:20, Vicente BOTET skrev:
>
>
>
>> Message du 02/05/11 22:50 De : "Thorsten Ottosen" A :
>> boost_at_[hidden] Copie à : Objet : Re: [boost] [BOOST CORE C++
>> Feature] the super or base keyword for C++
>>
>> Den 01-05-2011 07:54, tymofey skrev:
>>>
>>>>> I was wondering if it makes sense to add the well known super
>>>>> or base keyword to the C++ language in a generic way. C++ has
>>>>> multiple inheritance, while java and C# do not, so super
>>>>> would be ambigous.
>>>
>>
>> Please see
>>
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2881.html
>
>
> It will be great if this technique could be used to emulate single
> inheritance base class aliases, so instead of duplicating the base
> type

> The single remaining problem is the forward constructor.
>
[snip]
> We could add a macro that generates base like classes with specific
> names and have
>
>
> template class bitset : PRIVATE_BASE_ALIAS(_Base, (_Base_bitset <
> ((_Nb)< 1 ? 0 : ((_Nb) + numeric_limits::digits - 1) /
> numeric_limits::digits)
>>
> )) { // private_base introduce _Base type in scope here };
>
> Of course macros are ugly and needs to double braquets.

Can you elaborate more on what you mean?

If there is only one base class, we can just say

using base::base;

If there are more base classes, then we probably can use either of the
inherited cobstructors.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk