[ROOT] STL vector::at() function

From: Paolo ADRAGNA (paolo.adragna@pi.infn.it)
Date: Sat Mar 29 2003 - 17:32:59 MET


Hello,
this is not exactly a question related to some ROOT feature, but I am a C++ 
programmer newby, so I search for answers wherever I can: the RootTalk is a 
good place I suppose.

I would like to use the "at" function of <vector> container but during 
compilation I get the error message

no matching function for call to `vector<int, allocator<int> >::at (int)'

I don't think my code is important because right after the error during 
compilation under ROOT environment I tried a small trial program, pippo.cpp:

#include <vector>
#include <iostream>

void main()
{
std::vector<int> vettore;
vettore.reserve(3);
vettore.clear();
vettore.at(5) = 56;
cout << "Vettore 5 =" << vettore.at(5) << endl;
}

Disgracefully I got newly an error message:

c++ -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -fno-exceptions 
-fno-check-new -c pippo.cpp 
pippo.cpp: In function `int main ()': 
pippo.cpp:10: no matching function for call to `vector
allocator >::at (int)' 
pippo.cpp:11: no matching function for call to `vector
allocator >::at (int)' 
gmake: *** [pippo.o] Error 1 
*** failed *** 

I also examined the header file stl_vector.h, but i didn't find any "::at" 
function. Where is my fault? Can you help me?

Thank you,

				Paolo Adragna


Paolo Adragna
INFN Sezione di Pisa



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET