2022-09-30 11:49:03 +00:00
|
|
|
#ifndef _RSTL_ALGORITHM_HPP
|
|
|
|
#define _RSTL_ALGORITHM_HPP
|
2022-08-13 12:57:38 +00:00
|
|
|
|
2022-09-18 05:55:13 +00:00
|
|
|
#include "rstl/pointer_iterator.hpp"
|
|
|
|
|
2022-08-13 12:57:38 +00:00
|
|
|
namespace rstl {
|
2022-10-04 00:00:46 +00:00
|
|
|
template < class It, class T >
|
|
|
|
inline It find(It first, It last, const T& val) {
|
2022-09-18 05:55:13 +00:00
|
|
|
while (first != last && !(*first == val))
|
|
|
|
++first;
|
|
|
|
return first;
|
2022-08-13 12:57:38 +00:00
|
|
|
}
|
2022-10-04 00:00:46 +00:00
|
|
|
|
|
|
|
template < typename T >
|
|
|
|
inline void swap(T& a, T& b) {
|
|
|
|
T tmp(a);
|
|
|
|
a = b;
|
|
|
|
b = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
template < typename I1, typename I2 >
|
|
|
|
inline void iter_swap(I1 a, I2 b) {
|
|
|
|
swap(*a, *b);
|
|
|
|
}
|
|
|
|
|
|
|
|
template < class It, class Cmp >
|
|
|
|
void __sort3(It a, It b, It c, Cmp comp); // TODO
|
|
|
|
|
|
|
|
template < typename It, class Cmp >
|
|
|
|
inline void sort(It first, It last, Cmp cmp); // TODO
|
2022-09-18 05:55:13 +00:00
|
|
|
} // namespace rstl
|
2022-10-04 00:00:46 +00:00
|
|
|
|
2022-09-30 11:49:03 +00:00
|
|
|
#endif // _RSTL_ALGORITHM_HPP
|