impl debug assets for sorted ranges

This commit is contained in:
2019-05-31 09:18:59 +07:00
parent 8fe5c749ff
commit 9038cd38e5
2 changed files with 64 additions and 6 deletions

View File

@@ -10,17 +10,29 @@ namespace flat_hpp::detail
{
template < typename Iter, typename Compare >
bool is_sorted(Iter first, Iter last, Compare comp) {
(void)first;
(void)last;
(void)comp;
if ( first != last ) {
Iter next = first;
while ( ++next != last ) {
if ( comp(*next, *first) ) {
return false;
}
++first;
}
}
return true;
}
template < typename Iter, typename Compare >
bool is_sorted_unique(Iter first, Iter last, Compare comp) {
(void)first;
(void)last;
(void)comp;
if ( first != last ){
Iter next = first;
while ( ++next != last ) {
if ( !comp(*first, *next) ) {
return false;
}
++first;
}
}
return true;
}
}