Topic: New Functionality.... Was (Is the STL too authentic...


Author: Sean A Corfield <sean@corf.demon.co.uk>
Date: 1995/10/18
Raw View
In article <9510170050.AA42882@cs90slave.csv-tgsc.amex-trs.com>,
jgreen@amex-trs.com wrote:

[anonymous functions]
Yes, I would like these too -- the issue was raised in one of the
Extensions WG sessions but really got no support.

|> Other features I would like to see:
|> -----------------------------------
|>
|> 1: Nested functions.

This has been discussed several times by the Extensions WG and the decision
was taken not to pursue this. I argued in favour of the extension because I
like nested functions but you can't win 'em all.

The closest you'll get is member functions of local classes, I think:

 struct interface
 {
   virtual void function() const = 0;
 };
 void f(const interface& i)
 {
 // do stuff with i.function()
 }
 void g()
 {
   struct local : public interface
   {
     void function() const { ... }
   };
   f(local());
 }

|> 2b: An series of overloaded virtual functions with the same name delared
with
|>     the variant key word will not be hidden when one or more of the
overload
|>     definitions is redeclared.

Something similar can be achieved with the using declaration:

|>     class b : public a
|>     {
|>         virtual foo( long );
           using a::foo; // brings in all base class variants
                         // to overload foo(long)
|>         // virtual foo( int ) and foo( double ) are not hidden.
|>     }
---
[ 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. ]