Boost logo

Boost :

Subject: Re: [boost] [iterator adaptor] requires default constructor?
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2010-06-11 21:46:38


Jeffrey Lee Hellrung, Jr. wrote:

> On 6/11/2010 6:14 PM, Neal Becker wrote:
>> IIUC, in typical usage, the default constructor will be called.
>> Here is my example:
> [...]
>> This is a bit confusing. IIUC, the issue is that we did not explicitly
>> invoke the super_t constructor, so we got the default constructor, which
>> in turn calls (iterator_adaptor.hpp:280)
>>
>> iterator_adaptor() {}
>>
>> Adding an explicity super_t constructor call fixes it:
> [...]
>> But is not very obvious.
>
> How so? Makes sense to me that you should be conscious of how the base
> class is constructed (assuming it is nontrivial) in all the derived
> class' constructors, regardless of the context...
>
> - Jeff

I see my confusion now. My iterator_adaptor was maintaining it's own
base iterator, instead of just using the base() provided by super_t.


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