Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-09-08 14:59:10


#include <boost/numeric/ublas/vector.hpp>

namespace ublas = boost::numeric::ublas;

void F () {
  ublas::vector<int> u (10);
  int y = *u.begin();
  int x = u.begin()[0];
}

This code fails to compile with g++34 + current boost.cvs.

Test.cc:8: error: no match for 'operator[]' in
'boost::numeric::ublas::vector<T, A>::begin() [with T = int, A =
boost::numeric::ublas::unbounded_array<int, std::allocator<int> >]()[0]'

u.begin() should return an iterator, and the iterator should define
operator[]. Why doesn't this work?


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