🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: possible extension -- typeof(expr)

#3621
From: Pablo Halpern
Date: Fri, 08 Mar 1996 16:23
37 lines
2163 bytes
tjb839@zacatecas.optimum.com (Tim Boemker) wrote:

>Many times in working with STL I've wished for a new operator to return
>the type of an expression, much the same way sizeof returns the size of
>an expression.
>
>It would allow programs like the following, for example:
>
>   set<foo, less<foo> > s;
>   for(typeof(s)::iterator i = s.begin(); i != s.end(); i++)
>      // do something

Actually, I'm surprized that the notation s.iterator is not valid. If
iterator were a static variable or function, instead of a nested class
or typedef, then it WOULD be valid. Has there been any discusion of
permitting this syntax? It seems like it would be easy to implement
(just an extention of the current scope-resolution rules) and would
solve many of the problems that typeof() addresses. The example would
look like this:

   set<foo, less<foo> > s;
   for(s.iterator i = s.begin(); i != s.end(); i++)
   //  ^^^^^^^^^^ why isn't this currently valid?
      // do something

-------------------------------------------------------------
Pablo Halpern                   phalpern@truffle.ultranet.com

I am self-employed. Therefore, my opinions *do* represent 
those of my employer.
---
[ To submit articles: try just posting with your news-reader.
                      If that fails, use mailto:std-c++@ncar.ucar.edu
  FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu.
]
Technical Details
Message-ID: <313f343f.11284615@news.ultranet.com>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <199603061757.AA17403@zacatecas.optimum.com>

Show Full Headers
Complete Article Headers
From: phalpern@truffle.ultranet.com (Pablo Halpern)
Message-ID: <313f343f.11284615@news.ultranet.com>
X-Original-Date: Fri, 08 Mar 1996 14:48:29 GMT
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 08 Mar 96 16:23:23 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: possible extension -- typeof(expr)
Organization: UltraNet Communications, Inc.
References: <199603061757.AA17403@zacatecas.optimum.com>
X-Newsreader: Forte Agent .99d/16.182
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMUBfEOEDnX0m9pzZAQH9cgF/WKvA1UFuQPob98dZbUlspbOmETxrxo6N
 07O+pIiW5KPFKztRU3O3dXwvObV7FhkH
 =+HDE