i have this strange error, i have isolated where the error might be in the below code
also, i tried to out this list<Item> bag; as part of the character object too
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\list(1194): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'Item' (or there is no acceptable conversion)
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\exception(475): or 'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\exception(481): or 'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(408): or 'bool std::operator ==(const std::error_code &,const std::error_condition &)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(416): or 'bool std::operator ==(const std::error_condition &,const std::error_code &)'
1> while trying to match the argument list '(Item, const Item)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\list(1188) : while compiling class template member function 'void std::list<_Ty>::remove(const _Ty &)'
1> with
1> [
1> _Ty=Item
1> ]
1> c:\users\gregory\documents\visual studio 2010\projects\smallfantasy\smallfantasy\character.h(22) : see reference to class template instantiation 'std::list<_Ty>' being compiled
1> with
1> [
1> _Ty=Item
1> ]
1> Generating Code...
1> Compiling...
1> Character.cpp
1> Generating Code...
1> Compiling...
1> main.cpp
1> Story.cpp
1> Consumable.cpp
1> Combat.cpp
1> Generating Code...
1>c:\users\gregory\documents\visual studio 2010\projects\smallfantasy\smallfantasy\story.cpp(17): warning C4715: 'Stat' : not all control paths return a value
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
std::list::remove() needs a way to know if two elements are equal (¿how could decide when to erase?)
Apart, methods should operate with the state of the object. However your code makes it so it does not matter to who you send the message to.
It's specially aggravating that an item (any item) is responsible for clearing an inventory.