Topic: Mathematical Sets using the C++ STL
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/05/30 Raw View
Juli=E1n Calder=F3n Almendros wrote:
> The problem is the ' std::set '.=20
std::set corresponds to the mathematical notion of a typed set=20
of objects of type T. Well, not all operations on set corresponds=20
to a mathematical set.
> For it unites application it is necessary
> me, incredibly, a set-set (in the mathematical sense). that is to say t=
hat
> interests me ' std::set <T> ' and ' std::set <std::set <T>> ',
> you already know, a set of the parts of that set (set that is power of =
a set).
BTW, the Set Theory is an untyped theory. std::set<T> has a type=20
different from T, and you cannot write
typedef std::set<T> T;=20
in C++ (sadly ?).
> The intringulis is that the ordination makes it by means of the ' opera=
tor
> <' of 'std::set <T>' that have had to overload.=20
The same thing as in all containners: it's the lexicographic=20
ordering. This is a general requirement. It may be unfortunate=20
for sets and multisets.
> The ' <' it consists in it unites
> strict inclusion.=20
No.
And here this the problem. When I insert objects of the
> type 'std::set <T>', be A, B and C, insert them if they are not equival=
ent,
> and not if they are not same (I also have overloaded ' operator =3D=3D =
').
You don't need to, except if you want to use =3D=3D on sets.
std::set never compare its elements with =3D=3D (again,=20
except when you compare sets with =3D=3D).
> And in this case
> equivalence and equality (in the sense of the STL) they don't coincide,
Of course they do (provided they do on your class T).
> If somebody has solutions or he/she knows some place of the web where t=
o
> look for, I thank him the information.
The documentation of the SGI STL is on the web:
http://www.sgi.com/Technology/STL/
--=20
Valentin Bonnard
---
[ 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: =?iso-8859-1?Q?Juli=E1n_Calder=F3n_Almendros?= <jcalderon@jet.es>
Date: 1999/05/28 Raw View
I am using the STL for all containers or TDA that I have to use because they
arise in my projects (of educational character or 'to investigate' -
glup! -).
The problem is the ' std::set '. For it unites application it is necessary
me, incredibly, a set-set (in the mathematical sense). that is to say that
interests me ' std::set <T> ' and ' std::set <std::set <T>> ',
you already know, a set of the parts of that set (set that is power of a set).
The intringulis is that the ordination makes it by means of the ' operator
<' of
'std::set <T>' that have had to overload. The ' <' it consists in it unites
strict inclusion. And here this the problem. When I insert objects of the
type 'std::set <T>', be A, B and C, insert them if they are not equivalent,
and not if they are not same (I also have overloaded ' operator == ').
And in this case
equivalence and equality (in the sense of the STL) they don't coincide, with
that if ((A < B) && (A != B)) and first I have introduced A, B doesn't
introduce it. And it is necessary me that introduces it.
If somebody has solutions or he/she knows some place of the web where to
look for, I thank him the information.
Julian Calderon Almendros.
Thank you in advance.
--
"Al principio estaba Eru, que en Arda es llamado Illuvatar, ..." de JRR
Tolkien.
Quisiera mirar por las estancias de Ea y ver la ilusi n que Eru provoc
en la mente de los Ainur.
[ 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 ]