Topic: MS VC++ 5.0 : vector<foo> required foo::operator=() and foo::operator<() ???
Author: "Michael Taylor" <mbtaylor@microsoft.com>
Date: 1998/02/05 Raw View
(I don't work on the compiler, but I use it.)
As has been pointed out several times this is a known bug in the compiler
that has been fixed in sp1, sp2 or sp3.
Tom McKearney wrote in message <6b8f8v$gaf$1@ha2.rdc1.md.home.com>...
>// BUG IN VC++ requires this
>bool operator<(const foo&, const foo&)
>{return false;}
>bool operator==(const foo&, const foo&)
>{return false;}
>
You don't need the definitions, you just need the declarations.
>
>I was wondering if P.J. Plauger reads this group, since he wrote the
version
>that MS uses for VC++ 5.0.
>It would be nice to hear his side of this.
>
I don't want to speak for Mr Plauger, but I think this was simply a compiler
bug, not a bug in the STL.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Brock" <peabody@npcinternational.com>
Date: 1998/02/05 Raw View
Tom McKearney wrote in message <6b8f8v$gaf$1@ha2.rdc1.md.home.com>...
>I was wondering if P.J. Plauger reads this group, since he wrote the
version
>that MS uses for VC++ 5.0.
>It would be nice to hear his side of this.
>
>Tom McKearney
The bug was in the compiler and had nothing to do with Plauger's code. The
bug was fixed with sp1 or sp2, I can now compile:
class X {};
std::vector<X> v(10);
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: "Tom McKearney" <no@spam.com>
Date: 1998/02/06 Raw View
Michael Taylor wrote in message <6bav2d$o8c@news.microsoft.com>...
>(I don't work on the compiler, but I use it.)
>
>As has been pointed out several times this is a known bug in the compiler
>that has been fixed in sp1, sp2 or sp3.
I apologize. Sorry for the noise...
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern/std-c++/faq.html ]
Author: "Tom McKearney" <no@spam.com>
Date: 1998/02/04 Raw View
John Deacon wrote in message <34D6D36C.6801F23A@cix.compulink.co.uk>...
[snip]
>I had the same problem, and I haven't fully resolved it yet. What's more,
vector
>used to work under the previous version of VC++. What little I have
discovered
>leads me to believe that you should only need to define these operators if
your
>code is comparing collections; you probably aren't; I'm certainly not. The
>suspicion,then, is that the way the template is being instantitated has
changed
>in the lastest version of VC++, and that these functions are being
instantiated
>even though they're not used. A real pain.
the only way I get them to work is to put this in my header file:
// BUG IN VC++ requires this
bool operator<(const foo&, const foo&)
{return false;}
bool operator==(const foo&, const foo&)
{return false;}
I was wondering if P.J. Plauger reads this group, since he wrote the version
that MS uses for VC++ 5.0.
It would be nice to hear his side of this.
Tom McKearney
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: "Tom McKearney" <no@spam.com>
Date: 1998/02/02 Raw View
Can someone tell me why the STL vector implementation in VC++ 5.0 requires
that the class being contained within that vector requires an operator<()
and an operator=() ?
I know these are required for container classes which are sorted (i.e. map<>
and rbtree<>), but why in vector<>? Is this a violation of the standard?
And, if it's not, why is it not?
Thanks very much,
Tom McKearney
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: John Deacon <jNOdeaSPAMcon@cix.compulink.co.uk>
Date: 1998/02/03 Raw View
Tom McKearney wrote:
> Can someone tell me why the STL vector implementation in VC++ 5.0 requires
> that the class being contained within that vector requires an operator<()
> and an operator=() ?
>
> I know these are required for container classes which are sorted (i.e. map<>
> and rbtree<>), but why in vector<>? Is this a violation of the standard?
> And, if it's not, why is it not?
>
> Thanks very much,
>
> Tom McKearney
I had the same problem, and I haven't fully resolved it yet. What's more, vector
used to work under the previous version of VC++. What little I have discovered
leads me to believe that you should only need to define these operators if your
code is comparing collections; you probably aren't; I'm certainly not. The
suspicion,then, is that the way the template is being instantitated has changed
in the lastest version of VC++, and that these functions are being instantiated
even though they're not used. A real pain.
--
_______________________________________________________________
John Deacon Email: jNOdeacSPAMon@cix.compulink.co.uk
of JDL
and Lattice Limited
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]