error message-help

Started by
8 comments, last by red-dragonX 20 years ago
hey guys, i''m one huge error away from finishing my work, but can''t understand what this error message means or what i''m doing wrong. here''s the message: "/opt/SUNWspro/WS6U2/include/CC/Cstd/./algorithm.cc", line 69: Error: The operat ion "Widget == const std::basic_string, std::alloca tor>" is illegal. "inventory.cc", line 23: Where: While instantiating "std::find>::iterator, std::basic_string, std::allocator>>(std::list>::iterat or, std::list>::iterator, const std::basic_string , std::allocator>&)". "inventory.cc", line 23: Where: Instantiated from non-template code. 1 Error(s) detected. in my code, line 69 is this: list::iterator have = find_if(available.begin(), available.end(), test); and line 23 is: list::iterator we_need = find(not_available.begin(), not_available.end(),widget.digits()); i''ve included #include <algorithm> on top... that''s what find and find_if belong to, correct? the only thing i can conclude from these error messages is that there''s a problem with find and find_if. thanks!
Advertisement
If I had to guess, I would say the problems seem to lie with test and widget.digits(). What types are those two?
quote:Original post by SiCrane
If I had to guess, I would say the problems seem to lie with test and widget.digits(). What types are those two?


i guess the name digits() is a bit misleading... it returns a string, containing numbers to this widget.
and the test comes from me making a separate tester class. i created this small class for defining the function call operator, allowing an instance of the class to be used as a function.

But what types does test::operator() accept and return? That is, what function signature is it imitating?
perhaps this will better answer your question:
within class tester, i have
bool operator () (Widget & widget)
{ return widget.digits() == test_digits; }


Actually, I think I was barking up the wrong tree. I re-read your error messages. Is not_available a std::list of Widget objects?
quote:Original post by SiCrane
Actually, I think I was barking up the wrong tree. I re-read your error messages. Is not_available a std::list of Widget objects?


not_available was declared under protected in a class like this:
list not_available; same with available.

So Widget.digits() is returning a std::string and you''re trying to use that string to search through a list of Widget''s? This is probably what''s causing the error, unless operator==() is overloaded on Widget to compare against a std::string.
hey SiCran, thanks for your replies. i finally figured it out, and it''s compiling for now.
have a g''nite!
Your welcome, and sorry for the false start back there.

This topic is closed to new replies.

Advertisement