Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-09-02 09:47:47


Eric Niebler <eric <at> boost-consulting.com> writes:

>
>
> Thorsten Ottosen wrote:
> > Eric Niebler <eric <at> boost-consulting.com> writes:
> >
> >>Is it documented
> >>anywhere, and I'm just not seeing it?
> >
> >
> > I think the best documentation was provided by you in your for-each docs.
> > If you don't mind, I would love to steal that some day
> >
> > In a perfect world, that would have been part of the range docs from the
> > beginning.
> >
>
> Don't. As I'm learning from this thread and from the foreach regression
> tests, the recommendations in the foreach docs for extending Boost.Range
> are wrong. I'm deeply confused. Please enlighten me as to the proper way
> to extend your library.

way 1:

(a) provide member functions
 - begin()
 - end()
 - size()

(b) provide member types
 - iterator
 - const_iterator
 - value_type
 - size_type
 - difference_type

way 2: (lacking from docs)

(a) provide free-standing member in namespace of the UDT:
   - begin()
   - end()
   - size()

(b) provide specializations for

  - boost::range_itetator
  - boost::range_const_iterator
  - boost::range_value
  - boost::range_difference
  - boost::range_size

A library might choose not to call boost::begin/end/size
unqualified...in which case that library does not support
UDTs.

Does it make sense? Have I forgotten something?

br

-Thorsten


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