Remove base/tl/sorted_array.h

This commit is contained in:
Robert Müller 2022-05-23 22:28:29 +02:00 committed by heinrich5991
parent a76cdb254e
commit bea74f3d4f
3 changed files with 0 additions and 64 deletions

View file

@ -1690,7 +1690,6 @@ set_src(BASE GLOB_RECURSE src/base
tl/allocator.h
tl/array.h
tl/range.h
tl/sorted_array.h
tl/threading.h
unicode/confusables.cpp
unicode/confusables.h
@ -2504,7 +2503,6 @@ if(GTEST_FOUND OR DOWNLOAD_GTEST)
secure_random.cpp
serverbrowser.cpp
serverinfo.cpp
sorted_array.cpp
str.cpp
strip_path_and_extension.cpp
teehistorian.cpp

View file

@ -1,53 +0,0 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef BASE_TL_SORTED_ARRAY_H
#define BASE_TL_SORTED_ARRAY_H
#include "base/tl/algorithm.h"
#include "base/tl/array.h"
template<class T, class ALLOCATOR = allocator_default<T>>
class sorted_array : public array<T, ALLOCATOR>
{
typedef array<T, ALLOCATOR> parent;
// insert and size is not allowed
int insert(const T &item, typename parent::range r)
{
dbg_break();
return 0;
}
int set_size(int new_size)
{
dbg_break();
return 0;
}
public:
typedef plain_range_sorted<T> range;
int add(const T &item)
{
return parent::insert(item, partition_binary(all(), item));
}
int add_unsorted(const T &item)
{
return parent::add(item);
}
void sort_range()
{
if(parent::size() > 0)
sort(all());
}
/*
Function: all
Returns a sorted range that contains the whole array.
*/
range all() { return range(parent::list, parent::list + parent::num_elements); }
range all() const { return range(parent::list, parent::list + parent::num_elements); }
};
#endif // TL_FILE_SORTED_ARRAY_HPP

View file

@ -1,9 +0,0 @@
#include <gtest/gtest.h>
#include <base/tl/sorted_array.h>
TEST(SortedArray, SortEmptyRange)
{
sorted_array<int> x;
x.sort_range();
}