📄 algorithm.qbk
字号:
__transform__(seq, f);[*Return type]: A model of __forward_sequence__[*Semantics]: Returns a new sequence, containing the return values of `f(e)` for each element `e` within `seq`.[heading Binary version synopsis] template< typename Sequence1, typename Sequence2, typename F > typename __result_of_transform__<Sequence1 const, Sequence2 const, F>::type transform( Sequence1 const& seq1, Sequence2 const& seq2, F f);[table Parameters [[Parameter][Requirement][Description]] [[`seq1`][A model of __forward_sequence__][Operation's argument]] [[`seq2`][A model of __forward_sequence__][Operation's argument]] [[`f`][`f(e1,e2)` is a valid expression for each pair of elements `e1` of `seq1` and `e2` of `seq2`. `__boost_result_of_call__<F(E1,E2)>::type` is the return type of `f` when called with elements of type `E1` and `E2`][Transformation function]]][*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a new sequence, containing the return values of `f(e1, e2)` for each pair of elements `e1` and `e2` within `seq1` and `seq2` respectively.[heading Complexity]Constant. Returns a view which is lazily evaluated.[heading Header] #include <boost/fusion/algorithm/transformation/transform.hpp> #include <boost/fusion/include/transform.hpp>[heading Example] struct triple { typedef int result_type; int operator()(int t) const { return t * 3; }; }; ... assert(__transform__(__make_vector__(1,2,3), triple()) == __make_vector__(3,6,9));[endsect][section replace][heading Description]Returns the result type of __replace__, given the types of the input sequence and element to replace.[heading Synopsis] template< typename Sequence, typename T > struct replace { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`T`][Any type][The type of the search and replacement objects]]][heading Expression Semantics] __result_of_replace__<Sequence,T>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns the return type of __replace__.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/replace.hpp> #include <boost/fusion/include/replace.hpp>[endsect][section replace_if][heading Description]Returns the result type of __replace_if__, given the types of the sequence, __poly_func_obj__ predicate and replacement object.[heading Synopsis] template< typename Sequence, typename F, typename T> struct replace_if { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`F`][A model of unary __poly_func_obj__][Replacement predicate]] [[`T`][Any type][The type of the replacement object]]][heading Expression Semantics] __result_of_replace_if__<Sequence,F,T>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns the return type of __replace_if__.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/replace_if.hpp> #include <boost/fusion/include/replace_if.hpp>[endsect][section remove][heading Description]Returns the result type of __remove__, given the sequence and removal types.[heading Synopsis] template< typename Sequence, typename T > struct remove { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`T`][Any type][Remove elements of this type]]][heading Expression Semantics] __result_of_remove__<Sequence, T>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a sequence containing the elements of `Sequence` not of type `T`. Equivalent to `__result_of_replace_if__<Sequence, boost::is_same<mpl::_, T> >::type`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/remove.hpp> #include <boost/fusion/include/remove.hpp>[endsect][section remove_if][heading Description]Returns the result type of __remove_if__, given the input sequence and unary __mpl_lambda_expression__ predicate types.[heading Synopsis] template< typename Sequence, typename Pred > struct remove_if { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`Pred`][A model of unary __mpl_lambda_expression__][Remove elements which evaluate to `boost::mpl::true_`]]][heading Expression Semantics] __result_of_remove_if__<Sequence, Pred>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a sequence containing the elements of `Sequence` for which `Pred` evaluates to `boost::mpl::false_`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/remove_if.hpp> #include <boost/fusion/include/remove_if.hpp>[endsect][section reverse][heading Description]Returns the result type of __reverse__, given the input sequence type.[heading Synopsis] template< typename Sequence > struct reverse { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __bidirectional_sequence__][Operation's argument]]][heading Expression Semantics] __result_of_reverse__<Sequence>::type[*Return type]: A model of __bidirectional_sequence__.[*Semantics]: Returns a sequence with the elements in the reverse order to `Sequence`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/reverse.hpp> #include <boost/fusion/include/reverse.hpp>[endsect][section clear][heading Description]Returns the result type of __clear__, given the input sequence type.[heading Synopsis] template< typename Sequence > struct clear { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][Any type][Operation's argument]]][heading Expression Semantics] __result_of_clear__<Sequence>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns an empty sequence.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/clear.hpp> #include <boost/fusion/include/clear.hpp>[endsect][section erase]Returns the result type of __erase__, given the input sequence and range delimiting iterator types.[heading Description][heading Synopsis] template< typename Sequence, typename It1, typename It2 = __unspecified__> struct erase { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`It1`][A model of __forward_iterator__][Operation's argument]] [[`It2`][A model of __forward_iterator__][Operation's argument]]][heading Expression Semantics] __result_of_erase__<Sequence, It1>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a new sequence with the element at `It1` removed. __result_of_erase__<Sequence, It1, It2>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a new sequence with the elements between `It1` and `It2` removed.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/erase.hpp> #include <boost/fusion/include/erase.hpp>[endsect][section erase_key][heading Description]Returns the result type of __erase_key__, given the sequence and key types.[heading Synopsis] template< typename Sequence, typename Key > struct erase_key { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __associative_sequence__][Operation's argument]] [[`Key`][Any type][Key type]]][heading Expression Semantics] __result_of_erase_key__<Sequence, Key>::type[*Return type]: A model of __associative_sequence__.[*Semantics]: Returns a sequence with the elements of `Sequence`, except those with key `Key`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/erase_key.hpp> #include <boost/fusion/include/erase_key.hpp>[endsect][section insert][heading Description]Returns the result type of __insert__, given the sequence, position iterator and insertion types.[heading Synopsis] template< typename Sequence, typename Position, typename T > struct insert { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`Position`][A model of __forward_iterator__][Operation's argument]] [[`T`][Any type][Operation's argument]]][heading Expression Semantics] __result_of_insert__<Sequence, Position, T>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a sequence with an element of type `T` inserted at position `Position` in `Sequence`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/insert.hpp> #include <boost/fusion/include/insert.hpp>[endsect][section insert_range][heading Description]Returns the result type of __insert_range__, given the input sequence, position iterator and insertion range types.[heading Synopsis] template< typename Sequence, typename Position, typename Range > struct insert_range { typedef __unspecified__ type; };[table Parameters [[Parameter][Requirement][Description]] [[`Sequence`][A model of __forward_sequence__][Operation's argument]] [[`Position`][A model of __forward_iterator__][Operation's argument]] [[`Range`][A model of __forward_sequence__][Operation's argument]]][heading Expression Semantics] __result_of_insert_range__<Sequence, Position, Range>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a sequence with the elements of `Range` inserted at position `Position` into `Sequence`.[heading Complexity]Constant.[heading Header] #include <boost/fusion/algorithm/transformation/insert_range.hpp> #include <boost/fusion/include/insert_range.hpp>[endsect][section join][heading Description]Returns the result of joining 2 sequences, given the sequence types.[heading Synopsis] template< typename LhSequence, typename RhSequence > struct join { typedef __unspecified__ type; };[heading Expression Semantics] __result_of_join__<LhSequence, RhSequence>::type[*Return type]: A model of __forward_sequence__.[*Semantics]: Returns a sequence containing the elements of `LhSequence` followed by the elements of `RhSequence`. The order of the elements in the 2 sequences is preserved.[heading Complexity]Constant.[heading Header]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -