Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-10-24 11:31:03


I'm a bit confused.

I'm working with blitz++. It has

template<typename T, int N> class Array ...

which already has a begin(), end(), but I can't use them. I'm specializing
boost::begin,end,etc to hide them (I don't want to modify the blitz Array
class)

If I specialize range_begin:

namespace boost {
  
  template<typename T, int N>
  inline typename blitz::array_iterator< blitz::Array<T,N> >::type
range_begin (blitz::Array<T,N> & a) {
    return blitz::range_begin (a);
  }
}

Then this doesn't work, it seems that boost::begin (blitz::Array<T,N>&)
finds the original begin(), but if I do:

namespace boost {
  
  template<typename T, int N>
  inline typename blitz::array_iterator< blitz::Array<T,N> >::type begin
(blitz::Array<T,N> & a) {
    return blitz::range_begin (a);
  }
}

it works as desired. My questions are:

1) Is this reasonable?
2) What is the advantage of using e.g., range_begin() instead of just
specializing boost::begin()?


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