Hello, can someone please explain the error I am getting in order to help me get my code to compile?
The error my compiler (GCC 4.2.3) is giving:Code:class RomanNumeral { UINT mValue; vector<Symbol> mSymbols; public: RomanNumeral(const string& romanNumeral); void addToSymbols(const char& c) { mSymbols.push_back(Symbol(c)); } }; RomanNumeral::RomanNumeral(const string& romanNumeral) { for_each(romanNumeral.begin(), romanNumeral.end(), mem_fun_ref(&RomanNumeral::addToSymbols)); sum fo = for_each(mSymbols.begin(), mSymbols.end(), sum()); // you also must check for subtraction symbols mValue = fo.Total; }
/usr/include/c++/4.2/bits/stl_algo.h: In function _Function std::for_each(_InputIterator, _InputIterator, _Function) [with _InputIterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Function = std::mem_fun1_ref_t<void, RomanNumeral, const char&>]:
problemA.cpp:84: instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:159: error: no match for call to (std::mem_fun1_ref_t<void, RomanNumeral, const char&>) (const char&)
/usr/include/c++/4.2/bits/stl_function.h:687: note: candidates are: _Ret std::mem_fun1_ref_t<_Ret, _Tp, _Arg>:perator()(_Tp&, _Arg) const [with _Ret = void, _Tp = RomanNumeral, _Arg = const char&]



LinkBack URL
About LinkBacks
perator()(_Tp&, _Arg) const [with _Ret = void, _Tp = RomanNumeral, _Arg = const char&] 


