Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

red-dragonX

error message-help

This topic is 5327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
If I had to guess, I would say the problems seem to lie with test and widget.digits(). What types are those two?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
But what types does test::operator() accept and return? That is, what function signature is it imitating?

Share this post


Link to post
Share on other sites
perhaps this will better answer your question:
within class tester, i have
bool operator () (Widget & widget)
{ return widget.digits() == test_digits; }


Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!