Topic: stl list
Author: Christophe Bourez <bourez@tcts.fpms.ac.be>
Date: 1997/02/13 Raw View
Hello world,
I am starting using STL and, especially, list of STL with user-defined
types (= U.D.T).
First at all, my compiler warns me against illegal structure
operations. Indeed, I must to define comparison operators, namely
operator== and operator<, what I do, and all runs properly.
Often or sometimes, my U.D.T's are not sortable and I feel like to
say that to declare operator< in my U.D.T is nonsense, and yet, I
would like to define an list of my U.D.T and work with it (without
using sort algorithms, of course). But my compiler send compile errors,
cos I 'must' to define operator<.
Well, my question is :
Is it a problem with my compiler trying to generate instanciation
of not used template code or is it a conception problem in STL ?
I rarely read news, could you please reply me to bourez@tcts.fpms.ac.be
Thanks to everyone helping me.
christophe bourez
---
[ 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: Matt Austern <austern@isolde.mti.sgi.com>
Date: 1997/02/13 Raw View
Christophe Bourez <bourez@tcts.fpms.ac.be> writes:
> Often or sometimes, my U.D.T's are not sortable and I feel like to
> say that to declare operator< in my U.D.T is nonsense, and yet, I
> would like to define an list of my U.D.T and work with it (without
> using sort algorithms, of course). But my compiler send compile errors,
> cos I 'must' to define operator<.
> Well, my question is :
> Is it a problem with my compiler trying to generate instanciation
> of not used template code or is it a conception problem in STL ?
It's a problem of the compiler trying to instantiate unused code.
This is a compiler bug; unfortunately, it's a bug that shows up in
several different compilers.
---
[ 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 ]