🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1618

Re: STL operators != > <= >=

#1618
From: Haim Kreitman
Date: Sun, 06 Aug 1995 09:55
29 lines
1886 bytes
Another realistic and usefull example of partial order is
representation of the field R+R (i.e. pairs of real numbers with by 
coordinate add, subtract, multiply and divide. The 'ONE' in this ring is 
the pair {1,1} and the 'ZERO' - the pair {0,0} )

class FloatFloat {
    float first;
    float second;
public:
    FloatFloat(double d=0)              { first=second=d;}
    FloatFloat(double d1,double d2)     { first=d1; second=d2;}
    FloatFloat operator+(const FloatFloat& ff) const
        { return FloatFloat(first+ff.first , second+ff.second;}
    FloatFloat operator*(const FloatFloat& ff) const
        { return FloatFloat(first*ff.first , second*ff.second;}
// etc... all arithmetics
    bool operator==(const FloatFloat& ff)
        { return first==ff.first && second==ff.second;}
//  The templated operator != is good.

    bool operator <(const FloatFloat& ff) const
        { return first < ff.first && second < ff.second;
//  Usual partial order in the R+R ring. Can be used for
//  checking of inclusion of rectangles in graphic software.
//  Here the templated definitions are useless, because of the
//  partial oreder and additional bool operator@
//  (where @ means "non-comparable") could be helpfull)

};
Technical Details
Message-ID: <4023ic$sss@lyman.pppl.gov>
Path: arc1-ca.pugleaf.net!nntpserver.pppl.gov!usenet
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com> <3vtcha$cbv@lyman.pppl.gov> <3vutg6$713@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntpserver.pppl.gov!usenet
From: Haim Kreitman <haim_kreitman@mail.stil.scitex.com>
Newsgroups: comp.std.c++
Subject: Re: STL operators != > <= >=
Date: 6 Aug 1995 09:55:24 GMT
Organization: Scitex LTD
Message-ID: <4023ic$sss@lyman.pppl.gov>
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com> <3vtcha$cbv@lyman.pppl.gov> <3vutg6$713@mujibur.inmind.com>
NNTP-Posting-Host: 149.115.14.35
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (Windows; I; 32bit)