関数アダプタ
bind2nd, bind1st :第一引数、第二引数を固定。
count_ifなどの..._if系統 template< class InputIterator, class UnaryPredicate > typename iterator_traits::difference_type count_if( InputIterator first, InputIterator last, UnaryPredicate p ); transform template< class InputIterator, class OutputIterator, class UnaryOperation > OutputIterator transform( InputIterator first1, InputIterator last1, OutputIterator d_first, UnaryOperation unary_op ); template< class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation > OutputIterator transform( InputIterator first1, InputIterator last1, InputIterator first2, OutputIterator d_first, BinaryOperation binary_op ); partition template< class BidirectionalIterator, class UnaryPredicate > BidirectionalIterator partition( BidirectionalIterator first, BidirectionalIterator last, UnaryPredicate p ); //generateは関数をn回呼び出すためにあり、引数とかを使うわけではない。 generate(v.begin(), v.end(), calc () ); //v[0] = 5とかでもその数字を使うわけではない。というか、使えない仕様になってる。
unaryFunctionになっていて、このままでは二つの引数を渡すことができない。どうしても渡したいときbind2ndとかを使って、一つの引数を固定することにより、あたかも、BinaryFunctionのような挙動を示す。