Skip to content
Snippets Groups Projects
Commit c8c02769 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

remove unused header

parent f0d36f5a
No related branches found
No related tags found
No related merge requests found
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FGGL_ECS3_UTILS_HPP
#define FGGL_ECS3_UTILS_HPP
#include <cstddef>
namespace fggl::utils {
template<typename T>
std::size_t search(const T *data, const std::size_t size, const T &v) {
// empty list == not found
if (size == 0) {
return size;
}
std::size_t left = 0;
std::size_t right = size - 1;
while (left <= right) {
std::size_t m = (left + right) / 2;
if (data[m] == v) {
return m;
} else if (v < data[m]) {
if (m == 0) {
return size;
}
right = m - 1;
} else {
left = m + 1;
}
}
return size;
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment