00001
00002 #ifndef _INSTIGATE_STL_INTERNAL_HEADER_IN_ALGORITHM
00003 #error This is an internal header file used to implement Instigate STL.\
00004 It should never be included directly by a program.
00005 #endif
00006
00007 #ifndef INSTIGATE_STL_UNIQUE_HPP
00008 #define INSTIGATE_STL_UNIQUE_HPP
00009
00058
00059 #include "concept.hpp"
00060 #include "_adjacent_find.hpp"
00061 #include "_unique_copy.hpp"
00062
00063
00064
00065
00066
00067
00068 namespace instigate {
00069 namespace stl {
00070 template <typename F>
00071 F unique(F b, F e);
00072 template <typename F, typename BP>
00073 F unique(F b, F e, BP p);
00074 }
00075 }
00076
00115 template <typename F>
00116 F instigate::stl::unique(F b, F e)
00117 {
00118 namespace FI = instigate::stl::forward_iterator;
00119 namespace LV = instigate::stl::lvalue_iterator;
00120 namespace EQ = instigate::generic::equality_comparable;
00121 typedef typename LV::interface<F>::value_type value_type;
00122 CHECK(FI::requirements<F>);
00123 CHECK(LV::requirements<F>);
00124 CHECK(EQ::requirements<F>);
00125 b = instigate::stl::adjacent_find(b, e);
00126 return instigate::stl::unique_copy(b, e, b);
00127 }
00128
00156 template <typename F, typename BP>
00157 F instigate::stl::unique(F b, F e, BP p)
00158 {
00159 namespace FI = instigate::stl::forward_iterator;
00160 namespace LV = instigate::stl::lvalue_iterator;
00161 namespace EQ = instigate::generic::equality_comparable;
00162 namespace BI = instigate::stl::binary_predicate;
00163 typedef typename LV::interface<F>::value_type value_type;
00164 CHECK(FI::requirements<F>);
00165 CHECK(LV::requirements<F>);
00166 CHECK(EQ::requirements<F>);
00167 CHECK(BI::requirements<BP>);
00168 b = instigate::stl::adjacent_find(b, e, p);
00169 return instigate::stl::unique_copy(b, e, b, p);
00170 }
00171
00172
00173
00174 #endif // INSTIGATE_STL_UNIQUE_HPP