🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Answers on a postcard

#151
From: Tom O Breton
Date: Sat, 12 Sep 1992 17:19
25 lines
977 bytes
Karl:

> If not, I would ask: How does one overload the comma operator while
> maintaining its attibutes as an operator?


It's of dubious usefulness but it can be done:

class thisclass
{ int&  operator,(int a); }

//To call this:  (thisclass)X, (int)Y ... (outside of arg-lists, of course)
  
This will return you an int, just as if the default comma operator had
executed.


In general, chain operators by returning references (Usually to the same
argument they took).

        Tom

-- 
The Tom spreads its huge, scaly wings and soars into the wild sky...      
up...       up...     out of sight...   (tob@world.std.com)
Technical Details
Message-ID: <BuH6sK.54r@world.std.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!world!tob
References: <92255.154216KKEYTE@ESOC.BITNET>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!world!tob
From: tob@world.std.com (Tom O Breton)
Subject: Re: Answers on a postcard
Message-ID: <BuH6sK.54r@world.std.com>
Organization: The World Public Access UNIX, Brookline, MA
References: <92255.154216KKEYTE@ESOC.BITNET>
Date: Sat, 12 Sep 1992 17:19:31 GMT
Lines: 25