🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Ray Brown Sat, 19 Aug 1995 02:07
C++ Standards Bug!!!
#1742
Author: Ray Brown
Date: Sat, 19 Aug 1995 02:07
30 lines
1121 bytes
Distribution:
The challenge: try to rewrite the last two lines of this code 
without a typedef (typedefs should never be required, right?).

//////////////////////////////////////////////////////////////
struct B
{
  void Foo(short);
};

struct A
{
  static void (B::* var)(short);
};


typedef void (B::*q)(short);
q A::var = B::Foo;

//////////////////////////////////////////////////////////////

-- 
#################################################################
Email: Ray.Brown@lawson.com
Phone: (612) 379-8086 x4393

---
[ 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. ]
Re: C++ Standards Bug!!!
#1746
Author: Steve Clamage
Date: Sat, 19 Aug 1995 19:46
32 lines
1251 bytes
Distribution:
Ray Brown <102336.141@CompuServe.COM> writes:

>The challenge: try to rewrite the last two lines of this code 
>without a typedef (typedefs should never be required, right?).

>//////////////////////////////////////////////////////////////
>struct B
>{
>  void Foo(short);
>};

>struct A
>{
>  static void (B::* var)(short);
>};

>typedef void (B::*q)(short);
>q A::var = B::Foo;
>//////////////////////////////////////////////////////////////

You can write it without a typedef like this:

void (B::* A::var)(short) = B::Foo;
--
Steve Clamage, stephen.clamage@eng.sun.com


---
[ 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. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads