Codechange: [core] Implement SmallVector using std::vector

The public and protected interface to SmallVector are unchanged
SmallVector now requires that items be default constructible
This isn't an issue since some contained items were previously created
uninitialized.

Temporary default constructors are added to the following structs
- SmallPair
- SmallStackItem
- GRFPresence

Where vector<bool> is required, transition immediately to std::vector
to avoid returning proxy object references.
This commit is contained in:
Henry Wilson
2018-09-20 22:41:43 +01:00
committed by PeterN
parent 7a32cf1401
commit 4b349c0f90
7 changed files with 90 additions and 116 deletions

View File

@@ -279,7 +279,7 @@ private:
StringFilter string_filter; ///< Filter for available games.
QueryString filter_editbox; ///< Filter editbox;
SmallVector<bool, 32> fios_items_shown; ///< Map of the filtered out fios items
std::vector<bool> fios_items_shown; ///< Map of the filtered out fios items
static void SaveGameConfirmationCallback(Window *w, bool confirmed)
{
@@ -824,7 +824,7 @@ public:
case SLIWD_FILTER_CHANGES:
/* Filter changes */
this->fios_items_shown.Resize(this->fios_items.Length());
this->fios_items_shown.resize(this->fios_items.Length());
uint items_shown_count = 0; ///< The number of items shown in the list
/* We pass through every fios item */
for (uint i = 0; i < this->fios_items.Length(); i++) {