📄 sequence.qbk
字号:
Returns a type convertible to `bool` that evaluates to `true` if thesequence is empty, else, evaluates to `false`.[heading Synopsis] template <typename Sequence> typename __result_of_empty__<Sequence>::type empty(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __forward_sequence__] [The sequence we wish to investigate.]]][heading Expression Semantics] empty(seq);[*Return type]: Convertible to `bool`.[*Semantics]: Evaluates to `true` if the sequence is empty, else, evaluatesto `false`.[heading Header] #include <boost/fusion/sequence/intrinsic/empty.hpp> #include <boost/fusion/include/empty.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(empty(v) == false);[endsect][section front][heading Description]Returns the first element in the sequence.[heading Synopsis] template <typename Sequence> typename __result_of_front__<Sequence>::type front(Sequence& seq); template <typename Sequence> typename __result_of_front__<Sequence const>::type front(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __forward_sequence__] [The sequence we wish to investigate.]]][heading Expression Semantics] front(seq);[*Return type]: Returns a reference to the first element in the sequence`seq` if `seq` is mutable and `e = o`, where `e` is the first element inthe sequence, is a valid expression. Else, returns a type convertable tothe first element in the sequence.[*Precondition]: `__empty__(seq) == false`[*Semantics]: Returns the first element in the sequence.[heading Header] #include <boost/fusion/sequence/intrinsic/front.hpp> #include <boost/fusion/include/front.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(front(v) == 1);[endsect][section back][heading Description]Returns the last element in the sequence.[heading Synopsis] template <typename Sequence> typename __result_of_back__<Sequence>::type back(Sequence& seq); template <typename Sequence> typename __result_of_back__<Sequence const>::type back(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __bidirectional_sequence__] [The sequence we wish to investigate.]]][heading Expression Semantics] back(seq);[*Return type]: Returns a reference to the last element in the sequence`seq` if `seq` is mutable and `e = o`, where `e` is the last element in thesequence, is a valid expression. Else, returns a type convertable to thelast element in the sequence.[*Precondition]: `__empty__(seq) == false`[*Semantics]: Returns the last element in the sequence.[heading Header] #include <boost/fusion/sequence/intrinsic/back.hpp> #include <boost/fusion/include/back.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(back(v) == 3);[endsect][section size][heading Description]Returns a type convertible to `int` that evaluates the number of elementsin the sequence.[heading Synopsis] template <typename Sequence> typename __result_of_size__<Sequence>::type size(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __forward_sequence__] [The sequence we wish to investigate.]]][heading Expression Semantics] size(seq);[*Return type]: Convertible to `int`.[*Semantics]: Returns the number of elements in the sequence.[heading Header] #include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/include/size.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(size(v) == 3);[endsect][section at][heading Description]Returns the N-th element from the beginning of the sequence.[heading Synopsis] template <typename N, typename Sequence> typename __result_of_at__<Sequence, N>::type at(Sequence& seq); template <typename N, typename Sequence> typename __result_of_at__<Sequence const, N>::type at(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __random_access_sequence__] [The sequence we wish to investigate.]] [[`N`] [An __mpl_integral_constant__] [An index from the beginning of the sequence.]]][heading Expression Semantics] at<N>(seq);[*Return type]: Returns a reference to the N-th element from the beginningof the sequence `seq` if `seq` is mutable and `e = o`, where `e` is the N-thelement from the beginning of the sequence, is a valid expression. Else,returns a type convertable to the N-th element from the beginning of thesequence.[*Precondition]: `0 <= N::value < __size__(s)`[*Semantics]: Equivalent to __deref__(__advance__<N>(__begin__(s)))[heading Header] #include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/include/at.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(at<mpl::int_<1> >(v) == 2);[endsect][section at_c][heading Description]Returns the N-th element from the beginning of the sequence.[heading Synopsis] template <int N, typename Sequence> typename __result_of_at_c__<Sequence, N>::type at_c(Sequence& seq); template <int N, typename Sequence> typename __result_of_at_c__<Sequence const, N>::type at_c(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __random_access_sequence__] [The sequence we wish to investigate.]] [[`N`] [An integral constant] [An index from the beginning of the sequence.]]][heading Expression Semantics] at_c<N>(seq);[*Return type]: Returns a reference to the N-th element from the beginningof the sequence `seq` if `seq` is mutable and `e = o`, where `e` is the N-thelement from the beginning of the sequence, is a valid expression. Else,returns a type convertable to the N-th element from the beginning of thesequence.[*Precondition]: `0 <= N < __size__(s)`[*Semantics]: Equivalent to __deref__(__advance__<N>(__begin__(s)))[heading Header] #include <boost/fusion/sequence/intrinsic/at_c.hpp> #include <boost/fusion/include/at_c.hpp>[heading Example] __vector__<int, int, int> v(1, 2, 3); assert(at_c<1>(v) == 2);[endsect][section has_key][heading Description]Returns a type convertible to `bool` that evaluates to `true` if thesequence contains an element associated with a Key, else, evaluates to`false`.[heading Synopsis] template <typename Key, typename Sequence> typename __result_of_has_key__<Sequence, Key>::type has_key(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __associative_sequence__] [The sequence we wish to investigate.]] [[`Key`] [Any type] [The queried key.]]][heading Expression Semantics] has_key<Key>(seq);[*Return type]: Convertible to `bool`.[*Semantics]: Evaluates to `true` if the sequence contains an elementassociated with Key, else, evaluates to `false`.[heading Header] #include <boost/fusion/sequence/intrinsic/has_key.hpp> #include <boost/fusion/include/has_key.hpp>[heading Example] __set__<int, char, bool> s(1, 'x', true); assert(has_key<char>(s) == true);[endsect][section at_key][heading Description]Returns the element associated with a Key from the sequence.[heading Synopsis] template <typename Key, typename Sequence> typename __result_of_at_key__<Sequence, Key>::type at_key(Sequence& seq); template <typename Key, typename Sequence> typename __result_of_at_key__<Sequence const, Key>::type at_key(Sequence const& seq);[heading Parameters][table [[Parameter] [Requirement] [Description]] [[`seq`] [Model of __associative_sequence__] [The sequence we wish to investigate.]] [[`Key`] [Any type] [The queried key.]]][heading Expression Semantics] at_key<Key>(seq);[*Return type]: Returns a reference to the element associated with Key fromthe sequence `seq` if `seq` is mutable and `e = o`, where `e` is theelement associated with Key, is a valid expression. Else, returns a typeconvertable to the element associated with Key.[*Precondition]: `has_key<Key>(seq) == true`[*Semantics]: Returns the element associated with Key.[heading Header] #include <boost/fusion/sequence/intrinsic/at_key.hpp> #include <boost/fusion/include/at_key.hpp>[heading Example] __set__<int, char, bool> s(1, 'x', true); assert(at_key<char>(s) == 'x');[endsect][section swap][heading Description]Performs an element by element swap of the elements in 2 sequences.[heading Synopsis] template<typename Seq1, typename Seq2> void swap(Seq1& seq1, Seq2& seq2);[heading Parameters][table [[Parameters] [Requirement] [Description]] [[`seq1`, `seq2`] [Models of __forward_sequence__][The sequences whos elements we wish to swap.]]][heading Expression Semantics] swap(seq1, seq2);[*Return type]: `void`[*Precondition]: `__size__(seq1) == __size__(seq2)`[*Semantics]: Calls `swap(a1, b1)` for corresponding elements in `seq1` and `seq2`./sequence/intrinsic/swap.hpp>[heading Example] __vector__<int, std::string> v1(1, "hello"), v2(2, "world"); swap(v1, v2); assert(v1 == __make_vector__(2, "world")); assert(v2 == __make_vector__(1, "hello"));[endsect][endsect][section Metafunctions][section begin][heading Description]Returns the result type of __begin__.[heading Synopsis] template<typename Seq> struct begin { typedef __unspecified__ type; };[table Parameters [[Parameter] [Requirement] [Description]] [[`Seq`][A model of __forward_sequence__][Argument sequence]]][heading Expression Semantics] result_of::begin<Seq>::type[*Return type]: An iterator modelling the same traversal concept as `Seq`.[*Semantics]: Returns the type of an iterator to the first element of `Seq`./sequence/intrinsic/begin.hpp>[heading Example] typedef __vector__<int> vec; typedef __result_of_begin__<vec>::type it; BOOST_MPL_ASSERT((boost::is_same<__result_of_deref__<it>::type, int&>))[endsect][section end][heading Description]Returns the result type of __end__.[heading Synopsis] template<typename Seq> struct end { typedef __unspecified__ type; };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -