Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-05-08 23:22:50

Thorsten Ottosen <thorsten.ottosen_at_[hidden]> writes:

> In the new version, this is how range_iterator is defined:
> namespace boost
> {
> template< typename C >
> struct range_iterator
> {
> mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
> BOOST_DEDUCED_TYPENAME range_const_iterator<
> BOOST_DEDUCED_TYPENAME remove_const<C>::type
> >::type,
> range_mutable_iterator<C>::type >::
> type type;
> };
> } // namespace boost

Well, I think the logic is probably right but I have to say the code
looks a lot more complex than it probably ought to. There are lots of
places where the current code could profit from refactoring; this
might be another such place. For example, if you make range_iterator
do the right thing always, (maybe) you could spell
range_const_iterator as follows:

  template <class T>
  struct range_const_iterator
    : range_iterator<T const>

It's just an example; you have to check it to make sure it works out.
Anyway, I suggest you look hard for simplifying refactorings before
you commit a big rewrite.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at