🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Implicit operation relationships

#2471
From: John Max Skaller
Date: Wed, 08 Nov 1995 17:25
26 lines
1845 bytes
jjb@watson.ibm.com (John Barton) wrote:
>In article <47dn87$a17@sunsystem5.informatik.tu-muenchen.de>,
>|> You can extend this idea:
>|>
>|> template<class T> T  operator- (T&a, T&b) { return a + (-b); }
>|> template<class T> T  operator- (T&a)      { return 0 - a; }
>|> template<class T> T& operator+ (T&a)      { return a; }
>|> template<class T> T& operator++(T&a)      { return a += 1; }
>|> template<class T> T& operator++(T&a,int)  { return ++a; }
>
>This will not work: it prevent you from writing any templates
>for these operators over types that do not have "1" or "0"
>or that need a definition other than the one above.

How does it prevent it? [Quote WP ??]

   
-- 
John Max Skaller               voice: 61-2-566-2189
81 Glebe Point Rd              fax:   61-2-660-0850
GLEBE NSW 2037                 email: maxtal@suphys.physics.oz.au
AUSTRALIA                      email: skaller@maxtal.com.au
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <47qnbu$f48@oznet03.ozemail.com.au>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <MATT.95Aug24221328@Austern> <46vaga$dng@marina.cinenet.net> <47dn87$a17@sunsystem5.informatik.tu-muenchen.de> <47l76s$qu1@watnews2.watson.ibm.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 08 Nov 95 17:25:02 GMT
Approved: fjh@cs.mu.oz.au
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Newsgroups: comp.std.c++
Subject: Re: Implicit operation relationships
X-Original-Date: 8 Nov 1995 16:54:22 GMT
Organization: MAXTAL
Message-ID: <47qnbu$f48@oznet03.ozemail.com.au>
References: <MATT.95Aug24221328@Austern> <46vaga$dng@marina.cinenet.net> <47dn87$a17@sunsystem5.informatik.tu-muenchen.de> <47l76s$qu1@watnews2.watson.ibm.com>
X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMKDn+OEDnX0m9pzZAQHbZwF+P62Wj6a5kL+xh1vJ7gw3F1ZM6YhDhaA7
 Gk2MO9m3buiSy5j2NHA53WAVOGzlY/FO
 =oCoR