|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-08 12:09:34
From: Thorsten Ottosen <nesotto_at_[hidden]>
>
> (2) go for a class like range_traits<T>::begin()...ect.
Given the set of things that must be specialized to make a type
conformant, as documented in
https://www.cs.aau.dk/~nesotto/C++/doc/boost_range.html#minimal_interface,
that seems like a beneficial thing to do. You could then
document a SinglePassRange traits class and a ForwardRange traits
class. I don't think that the usual arguments against traits
blobs apply here.
With the traits classes, the concepts can be defined in terms of
proper specialization of the traits classes. (Your support for
Standard containers can be provided via library-supplied
specializations so the containers can be documented as satisfying
the Range concepts because of those specializations.)
The existing interface--boost::begin(), etc.--can be rewritten to
use the traits class interface.
The naming of the traits classes, which become the customization
points, remains something of an issue however. They could be
single_pass_range_traits and forward_range_traits in the boost
namespace, but that hardly fits the goal of enabling their
adoption as widely accepted, public domain, customization points.
Putting them in the global namespace may be too presumptuous. I
don't know what the right answer is.
-- 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