
From: "Reece Dunn" <msclrhd@hotmail.com>
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@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;