Article View: borland.public.cppbuilder.oodesign
Article #36Re: Taking operator overloading too far?
From: Alisdair Meredith [TeamB]
Date: Tue, 01 Feb 2005 16:44
Date: Tue, 01 Feb 2005 16:44
29 lines
2066 bytes
2066 bytes
Andrue Cope [TeamB] wrote: > The main objection I have to this is that if you overload '==' > shouldn't you also overload '>' etc. (and what would '>' mean in this > context come to that)? By the same argument, would you say that complex number classes should not implement operator== as you cannot (mathematically) order two such numbers? What about vector classes? If operator== is clear in the context, then it is valuable. If it is at all open to questions and vagueness, then I say use a named function call instead. You might like to read Thomas reply to your question before deciding how clear the equivalence is <g> Always think about how someone else could mis-interpret your operator overload before deciding to go with it. They are an incredibly valuable shorthand for communicating ideas, cross language boundaries well in international teams, beat easily lead to mis-understanding if not 100% closed to mis-interpretation. You also might like to search the web for comments by Dave Abrahams on DSELs. Domain Specific Embedded Languages. This is something that C++ does very well, and I find it hard to think of operator overloading in any other context now. AlidairM
Technical Details
Message-ID:
<41ffb207@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41ff924d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,6c4cb604a6b19d7 X-Google-Attributes: gid10db1e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Alisdair Meredith [TeamB]" <alisdair.NO.SPAM.PLEASE.meredith@uk.renaultf1.com> Subject: Re: Taking operator overloading too far? Newsgroups: borland.public.cppbuilder.oodesign References: <41ff924d@newsgroups.borland.com> Organization: Renault F1 Team Ltd. User-Agent: XanaNews/1.16.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 NNTP-Posting-Host: 195.153.139.2 Message-ID: <41ffb207@newsgroups.borland.com> Date: 1 Feb 2005 08:44:55 -0800 X-Trace: newsgroups.borland.com 1107276295 195.153.139.2 (1 Feb 2005 08:44:55 -0800) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail