oldmanstan
December 26th, 2005, 12:20 AM
Ok, basically I need to know why this won't work...
Essentially I am trying to create a vector of vectors of ints then insert ints into the vectors of ints. I have been programming on and off for roughly 15 years but I'm a relative newbie to c++.
#include <vector>
int main() {
typedef std::vector<int> IntVec;
std::vector<IntVec> VecOfVec(5);
VecOfVec.at(0).insert( 10 );
}
Here is the error message g++ spits out...
vecinvectest.cc: In function ‘int main()’:
vecinvectest.cc:17: error: no matching function for call to ‘std::vector<int, std::allocator<int> >::insert(int)’
/usr/include/c++/4.0.2/bits/vector.tcc:93: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]
/usr/include/c++/4.0.2/bits/stl_vector.h:657: note: void std::vector<_Tp, _Alloc>::insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]
Any help would be greatly appreciated!
Essentially I am trying to create a vector of vectors of ints then insert ints into the vectors of ints. I have been programming on and off for roughly 15 years but I'm a relative newbie to c++.
#include <vector>
int main() {
typedef std::vector<int> IntVec;
std::vector<IntVec> VecOfVec(5);
VecOfVec.at(0).insert( 10 );
}
Here is the error message g++ spits out...
vecinvectest.cc: In function ‘int main()’:
vecinvectest.cc:17: error: no matching function for call to ‘std::vector<int, std::allocator<int> >::insert(int)’
/usr/include/c++/4.0.2/bits/vector.tcc:93: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]
/usr/include/c++/4.0.2/bits/stl_vector.h:657: note: void std::vector<_Tp, _Alloc>::insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]
Any help would be greatly appreciated!