|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2004-05-21 11:50:20
From: "Reece Dunn" <msclrhd_at_[hidden]>
> Rob Stewart wrote:
>
> >I'm still missing something. Why would you want a non-const mf
> >to return the const iterator type?
>
> That was a typeo!
>
> > class char_string
> > {
> > virtual iterator begin() = 0;
> > virtual const_iterator begin() const = 0;
> > };
>
> That is what I was referring to. You need to change the name of the const
> version if you are to allow virtual functions.
Why?
> >case, because the const and non-const functions return different
> >types, you can't have the derived class implement a const
> >implementation function that the adaptor can use to provide both
> >const and non-const interface functions. So what am I missing?
>
> Nothing. You do indeed need two functions:
> iterator iter_offset( difference_type );
> const_iterator const_iter_offset( difference_type ) const;
Why? This is perfectly valid C++:
iterator iter_offset(different_type);
const_iterator iter_offset(different_type) const;
So is there something in how you want to use them that precludes
your overloading them that way?
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk