Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-05-03 18:32:52

I am trying to follow David's suggestion:

  double getitem(const std::vector<double>& vd, std::size_t key) {

This compiles fine with VC60, Compaq cxx, Silicon Graphics CC,
but NOT with gcc-2.95.2 (RedHat 6.1):

g++ -I/net/cci/rwgk/boost -I/usr/include/python1.5 -ftemplate-depth-
21 -g -c simple_vector.cpp
simple_vector.cpp: In function `double {anonymous}::getitem(const
vector<double,allocator<double> > &, unsigned int)':
simple_vector.cpp:36: no matching function for call to
`vector<double,allocator<double> >::at (size_t &) const'
make: *** [simple_vector.o] Error 1

I tried to remove the namespace {anonymous}, and casting
to (unsigend int), to no avail.

Could it be that gcc-2.95.2 is that seriously broken?
Or is it just that I am being stupid about something?


--- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> Why not just wrap std::vector<long> and provide the appropriate
> operations?
> boost/libs/python/example/simple_vector.cpp has an example.
> Ralf, it looks to me like getitem() in this example should use at()
or some
> other way of raising an IndexError when the index is out-of-range.
> Otherwise, you won't be able to write "for x in v:" without the
> crashing(!).
> -Dave

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