Jump to content
  • Advertisement

Archived

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

Vetinari

STL error

This topic is 6935 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

Can anyone tell me what this means?? C:\Program Files\DevStudio\VC\INCLUDE\functional(69) : error C2784: ''bool __cdecl std::operator !=(const class std::list<`template-parameter-1'',`template-parameter-2''> &,const class std::list<`template-parameter-1'',`template-parameter-2''> &)'' : coul d not deduce template argument for ''const class std::list<`template-parameter-1'',`template-parameter-2''> &'' from ''const class Triple'' Thanks, Mike

Share this post


Link to post
Share on other sites
Advertisement
Well, that is part of the problem. It''s not my code, and I''m having a hell of a time figuring out where the error is. The actual error points to inside STL, that''s why.

Mike

Share this post


Link to post
Share on other sites
Template errors are notoriously badly tracked by compilers. Maybe compiler writers will improve this at a later stage.

I will hazard a random guess at what the problem -could- be: do you have an equality operator (==) for your Triple class? If not, try defining one.

You should be able to work out which .CPP file is causing the error. And it is apparently a std::list operation which it is having trouble with, so perhaps if you were able to say what list operations you were using, we could help more.

Share this post


Link to post
Share on other sites
OK so I found out which header it was in. I added a != operator and that fixed it. Kinda pisses me off how MS''s implementation of STL is so different from others (I''m porting this from GNU).


Mike

Share this post


Link to post
Share on other sites
Which version of VC and which service pack are you using? MS''s STL has had several bugs where creating STL objects of a certain type was causing ALL member functions to be instantiated, even if they weren''t being used. Thus, you ended up having to overload things like != (one of the few operators used by STL) even though a conforming implementation wouldn''t have required it. If you''re using VC5, get the latest SP... If this is happening with VC6, I''d be somewhat surprised... (Well, actually, nothing about MS''s compiler should surprise me anymore)

-Brian

Share this post


Link to post
Share on other sites
It seems strange to me that STL uses the != operator in this case. Surely it should be able to synthesize that by simply negating the results of the == operator? (Which is why I suggested to add an == operator above?) AFAIK, you should only really have to add an == and a < operator, and all other relationals can be deduced from those..?

Share this post


Link to post
Share on other sites
What code that uses STL do you have?

Maybe you have to provide all arguments to the template, because not all compilers correcly implement default template arguments. It depends on what STL class you''re using though what that arguments should be.

Erik

Share this post


Link to post
Share on other sites
No, I had a == and < operator, and it made me implement a > and != operator. It may be that I am using VC5 as osmanb said.
Osmanb - where would I get the latest SP (what is an SP?).
Thanks for your help everyone,

Mike

Share this post


Link to post
Share on other sites
sp - service pack.
i don''t know where you could find service packs for vc5, but i''m sure they''re somewhere on msdn.microsoft.com.

crazy166
some people think i'm crazy, some people know it

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!