1 .. Algorithms/Transformation Algorithms//unique |80
14 , typename In = |unspecified|
18 typedef |unspecified| type;
25 Returns a sequence of the initial elements of every subrange of the
26 original sequence ``Seq`` whose elements are all the same.
28 |transformation algorithm disclaimer|
35 #include <boost/mpl/unique.hpp>
41 |Reversible Algorithm|
47 +---------------+-----------------------------------+-------------------------------+
48 | Parameter | Requirement | Description |
49 +===============+===================================+===============================+
50 | ``Sequence`` | |Forward Sequence| | An original sequence. |
51 +---------------+-----------------------------------+-------------------------------+
52 | ``Pred`` | Binary |Lambda Expression| | An equivalence relation. |
53 +---------------+-----------------------------------+-------------------------------+
54 | ``In`` | |Inserter| | An inserter. |
55 +---------------+-----------------------------------+-------------------------------+
61 |Semantics disclaimer...| |Reversible Algorithm|.
63 For any |Forward Sequence| ``s``, a binary |Lambda Expression| ``pred``,
64 and an |Inserter| ``in``:
69 typedef unique<s,pred,in>::type r;
75 If ``size<s>::value <= 1``, then equivalent to
79 typedef copy<s,in>::type r;
81 otherwise equivalent to
85 typedef lambda<pred>::type p;
86 typedef lambda<in::operation>::type in_op;
87 typedef apply_wrap\ ``2``\<
95 , pair< in_state, front<s>::type >
97 apply_wrap\ ``2``\<p, second<_1>, _2>
98 , identity< first<_1> >
99 , apply_wrap\ ``2``\<in_op, first<_1>, _2>
107 Linear. Performs exactly ``size<s>::value - 1`` applications of ``pred``, and at
108 most ``size<s>::value`` insertions.
116 typedef vector<int,float,float,char,int,int,int,double> types;
117 typedef vector<int,float,char,int,double> expected;
118 typedef unique< types, is_same<_1,_2> >::type result;
120 BOOST_MPL_ASSERT(( equal< result,expected > ));
126 |Transformation Algorithms|, |Reversible Algorithm|, |reverse_unique|, |remove|, |copy_if|, |replace_if|