1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

fixed CAddInfo::operator[] (mutable version)

This commit is contained in:
Henning Koehler 2018-03-17 11:03:02 +13:00
parent 7f76648a7c
commit 68b757eb53
2 changed files with 9 additions and 2 deletions

View File

@ -178,6 +178,13 @@ bool CAddInfo::operator!=(si32 value) const
return !operator==(value);
}
si32 & CAddInfo::operator[](size_type pos)
{
if (pos <= size())
resize(pos + 1, CAddInfo::NONE);
return vector::operator[](pos);
}
si32 CAddInfo::operator[](size_type pos) const
{
return pos < size() ? vector::operator[](pos) : CAddInfo::NONE;

View File

@ -90,7 +90,7 @@ private:
class DLL_LINKAGE CAddInfo : public std::vector<si32>
{
public:
static const si32 NONE = -1;
enum { NONE = -1 };
CAddInfo();
CAddInfo(si32 value);
@ -98,7 +98,7 @@ public:
bool operator==(si32 value) const;
bool operator!=(si32 value) const;
using std::vector<si32>::operator[];
si32 & operator[](size_type pos);
si32 operator[](size_type pos) const;
std::string toString() const;