Board index » cppbuilder » Re: std::iterator bcb3 versus bcb6

Re: std::iterator bcb3 versus bcb6

2007-02-13 06:29:45 AM
On 08/02/2007, Remy Lebeau (TeamB) wrote:
Since you are using forward_iterator_tag, you can derive your iterator
class from std::forward_iterator instead of std::iterator directly.
The template parameter for std::forward_iterator are the same in BCB 3
and 6.

class const_iterator : public std::forward_iterator<T, size_t>
Thanks for responding so quickly to this. The above works well in my
container as it's (sort of) a singly linked list and I only needed a
Simon Elliott

Re:Re: std::iterator bcb3 versus bcb6

On 08/02/2007, Chris Uzdavinis (TeamB) wrote:
The standard committee only decided to require that the first N
template arguments match those as specfied. If additional parameters
are added they must have defaults.

The consequence is that there is no universal signature for standard
library template types, as the arguments are part of the signature.

Probably your best bet is some use of macros. Sorry.
Thanks for this. So If I'd chosen to use
class const_iterator:public std::iterator<std::forward_iterator_tag, T,
would the defaults have been used and would I have had a valid solution
for BCB3 and BCB6?
For the moment I've followed Remy Lebeau's suggestion of deriving hte
iterator std::forward_iterator.
My next task is to try this on g++ ...
Simon Elliott