Bonjour � tous.
J'ai un petit code, rien de bien compliqu� mais ca plante quand m�me et je ne comprend pas pourquoi.
Voici le code:
Comme indiqu�, ca cplante sur std::copy et je en comprend pas pourquoi.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <algorithm> #include <iostream> #include <vector> #include <boost/array.hpp> //using namespace boost::assign; using namespace std; int main() { boost::array<int,5> array1; array1.assign(42); std::vector<int> result; copy(array1.begin(),array1.end(),result.begin()); //la ligne fautive cout<<"s: "<<result.size()<<endl; for(int i=0;i<result.size();i++) cout<<result[i]<<" "<<i<<endl; return 0; }
Quelqu'un � t'il une id�e ?
Annexe:
le backtrace de gdb:
*Code compil� avec g++ 4.2.3 sous windows et linux.#0 0xb7da22f3 in memmove () from /lib/i686/cmov/libc.so.6
#1 0x08048e36 in std::__copy<true, std::random_access_iterator_tag>::copy<int>
()
#2 0x08048e71 in std::__copy_aux<int*, int*> ()
#3 0x08048ea1 in std::__copy_normal<false, true>::__copy_n<int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > > > ()
#4 0x08048eed in std::copy<int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > > > ()
#5 0x08048a85 in main ()
Merci.
Edit: si je remplace le std::vector par un boost::array de taille suffissante, ca passe sans probl�me![]()
Partager