File indexing completed on 2024-06-23 05:45:41
0001 /* 0002 * Copyright 2020 Han Young <hanyoung@protonmail.com> 0003 * Copyright 2020 Devin Lin <espidev@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 namespace KClock 0011 { 0012 template<class C> 0013 int insert_index(const typename C::value_type &obj, 0014 const C &container, 0015 bool (*less_than)(const typename C::value_type &left, const typename C::value_type &right)) 0016 { 0017 int index = 0; 0018 for (auto element : container) { 0019 if (less_than(obj, element)) { 0020 return index; 0021 } 0022 ++index; 0023 } 0024 return index; 0025 }; 0026 }