刚写的程序中犯的一个低级错误。。。。

typedef ::std::vector< int > IntArray;



IntArray theInts;



IntArray::iterator it1, it2;


….


::std::swap( it1, it2 );// error!, should be ::std::swap( *it1, *it2 );


 


很早以前曾犯的另一个错误:


IntArray theInts;



int* g_pTheInt;



g_pTheInt = &( *it ) or it;//无效,::std::vector会reallocate。。。


 


自醒。。。

This entry was posted in 技术. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word