After painfull debugging due weird build messages I figured that this code causes problems:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
struct Castable
{
Castable(std::string Name, int Value, int Cost) : Name(Name), Value(Value), Cost(Cost) {}
const std::string Name;
const int Value;
const int Cost;
};
struct Buff : public Castable
{
Buff(std::string Name, Attribute Attribute, int Value, int Cost) : Castable(Name, Value, Cost)
{
this->Attribute = Attribute;
}
Attribute Attribute;
};
|
If I remove const-ness it will compile. Where is the problem?
These are build errors (200 lines, thus pastebin):
http://pastebin.com/fsz9pLni
Last edited on
error C2582: 'operator =' function is unavailable in 'Buff'
says that you try to use
Buff b, c;
b = c;
(or you try to use vector< Buff > )
without existing operator=
when members are const - you can't change them, so default operator= can't be created
@codekiddy
thats was typo :)
@Ivan Sidarau
Yeah, I tried to use vector<Buff>, but I do not understand how does that try to change them.