mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-08 05:49:15 +00:00
Update kernel
This commit is contained in:
65
include_std/algorithm
Normal file
65
include_std/algorithm
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <typename InputIt, typename OutputIt>
|
||||
OutputIt copy(InputIt first, InputIt last, OutputIt result)
|
||||
{
|
||||
while (first != last)
|
||||
{
|
||||
*result = *first;
|
||||
++result;
|
||||
++first;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void swap(T &a, T &b)
|
||||
{
|
||||
T temp = move(a);
|
||||
a = move(b);
|
||||
b = move(temp);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr const T &min(const T &a, const T &b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr const T &max(const T &a, const T &b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
template <class InputIt, class T>
|
||||
InputIt find(InputIt first, InputIt last, const T &value)
|
||||
{
|
||||
while (first != last)
|
||||
{
|
||||
if (*first == value)
|
||||
return first;
|
||||
++first;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user