|
Boost : |
From: Rainer Deyke (root_at_[hidden])
Date: 2001-12-22 08:55:16
----- Original Message -----
From: "James Mitchell" <jimdesu_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, December 22, 2001 2:23 AM
Subject: [boost] range processing extension(s)
> template <typename B, typename E>
> class range
> {
> B begin_;
> E end_;
> public:
> template< typename T>
> range(T container): begin_(container.begin()),
> end_(container.end()){};
> range(B begin, E end):begin_(begin), end_(end){};
> /* canonical entries here */
> operator*() { return *begin_; }
> operator bool() { return begin_ == end_ };
> /* incrementers and decrementers here */
> B begin();
> E end();
> };
Several problems:
- I can't think of any real-life case where separate types for 'begin_' and
'end_' would be useful, and having to secify the same iterator type twice is
not good.
- The first constructor as written here is obviously broken. (It need to
take its argument by reference.)
- It is unclear how this class should be used. If used simply to hold two
iterator, 'operator*' and the incerementers/decrementers are unnecessary.
If used directly for iteration, it needs to expose the full functionality of
the underlying iterators (including random access for random access
iterators).
-- Rainer Deyke (root_at_[hidden]) Shareware computer games - http://rainerdeyke.com "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk