public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13542] New: the overload of < operator doesn't work for complex<double> when use stl sort
@ 2004-01-02 4:37 tjiq at 21cn dot com
2004-01-02 5:07 ` [Bug libstdc++/13542] " pinskia at gcc dot gnu dot org
2004-01-02 6:44 ` pinskia at physics dot uc dot edu
0 siblings, 2 replies; 3+ messages in thread
From: tjiq at 21cn dot com @ 2004-01-02 4:37 UTC (permalink / raw)
To: gcc-bugs
the code following doesn't compile:
typedef complex<double> Tp;
vector<Tp> vp;
int operator<(const Tp &a, const Tp &b)
{
return a.imag()<b.imag();
}
sort(vp.begin(),vp.end());
--
Summary: the overload of < operator doesn't work for
complex<double> when use stl sort
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tjiq at 21cn dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13542
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/13542] the overload of < operator doesn't work for complex<double> when use stl sort
2004-01-02 4:37 [Bug c++/13542] New: the overload of < operator doesn't work for complex<double> when use stl sort tjiq at 21cn dot com
@ 2004-01-02 5:07 ` pinskia at gcc dot gnu dot org
2004-01-02 6:44 ` pinskia at physics dot uc dot edu
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-02 5:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-02 05:07 -------
Your op< is in the global namespace, but at the place where
it is used (inside std::sort), only
operators in namespace std are looked up because both operands
are in namespace std. There are several other instances
of this bug/feature in the database.
You can work around the problem by putting the op< into
namespace std.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |libstdc++
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13542
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/13542] the overload of < operator doesn't work for complex<double> when use stl sort
2004-01-02 4:37 [Bug c++/13542] New: the overload of < operator doesn't work for complex<double> when use stl sort tjiq at 21cn dot com
2004-01-02 5:07 ` [Bug libstdc++/13542] " pinskia at gcc dot gnu dot org
@ 2004-01-02 6:44 ` pinskia at physics dot uc dot edu
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at physics dot uc dot edu @ 2004-01-02 6:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at physics dot uc dot edu 2004-01-02 06:44 -------
Subject: Re: the overload of < operator doesn't work for complex<double> when use stl sort
On Jan 2, 2004, at 01:37, Jiqing Tang wrote:
> Thx a lot, it solves my problem,
>
> I just wonder if I use BCC32, it doesn't require me to declare the <
> operator in the std namespace, does that conform to the
> standard?
no, then BCC32 does not conform to the standard.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13542
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-02 6:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-02 4:37 [Bug c++/13542] New: the overload of < operator doesn't work for complex<double> when use stl sort tjiq at 21cn dot com
2004-01-02 5:07 ` [Bug libstdc++/13542] " pinskia at gcc dot gnu dot org
2004-01-02 6:44 ` pinskia at physics dot uc dot edu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).