mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08:00
Simplify away ValueListInserter
plus minor cleanups STC: https://tests.stockfishchess.org/tests/view/616f059b40f619782fd4f73f LLR: 2.94 (-2.94,2.94) <-2.50,0.50> Total: 84992 W: 21244 L: 21197 D: 42551 Ptnml(0-2): 279, 9005, 23868, 9078, 266 closes https://github.com/official-stockfish/Stockfish/pull/3749 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
8a8640a761
commit
644f6d4790
17
src/misc.h
17
src/misc.h
@@ -111,22 +111,6 @@ class RunningAverage {
|
||||
int64_t average;
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
class ValueListInserter {
|
||||
public:
|
||||
ValueListInserter(T* v, std::size_t& s) :
|
||||
values(v),
|
||||
size(&s)
|
||||
{
|
||||
}
|
||||
|
||||
void push_back(const T& value) { values[(*size)++] = value; }
|
||||
private:
|
||||
T* values;
|
||||
std::size_t* size;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t MaxSize>
|
||||
class ValueList {
|
||||
|
||||
@@ -140,7 +124,6 @@ public:
|
||||
const T& operator[](std::size_t index) const { return values_[index]; }
|
||||
const T* begin() const { return values_; }
|
||||
const T* end() const { return values_ + size_; }
|
||||
operator ValueListInserter<T>() { return ValueListInserter(values_, size_); }
|
||||
|
||||
void swap(ValueList& other) {
|
||||
const std::size_t maxSize = std::max(size_, other.size_);
|
||||
|
||||
Reference in New Issue
Block a user