2006-01-29から1日間の記事一覧

bind2nd

std::bind2nd は参照を引数にとる関数を受け取れない。内部で参照の参照を引き起こすため。 http://www.radiumsoftware.com/0304.html#030417 http://boost.org/libs/functional/binders.html 誰でも一度はつきあたる問題みたい。 #include <iostream> #include <vector> #incl</vector></iostream>…

copy_if

copy_if は C++ 標準には入っていないので自分で作らなければならない。 template<class InputIterator, class OutputIterator, class Predicate> OutputIterator copy_if(InputIterator begin, InputIterator end, OutputIterator dest_begin, Predicate p) { while( begin != end ) { if( p( *begin ) ){ *dest_begin++ </class>…

初期化は内部的にnewしなおすことで実装でよいか。