STL error

Started by
9 comments, last by Vetinari 24 years ago
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
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown
Advertisement
What''s the code that gave you that error? It would be much easier to tell from the code.
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
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown
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.
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
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown
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
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..?
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
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
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown
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

This topic is closed to new replies.

Advertisement