🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

void as template argument

#1830
From: Jorma Tolonen
Date: Wed, 23 Aug 1995 20:11
29 lines
1340 bytes
Is it OK to use void as an argument in a template-class. Example:

template <class Pointer>
class Base
{
public:
   Base() { }
   virtual ~Base() { }
   virtual void DoIt() = 0;
   static void func(Pointer* client_data) { ((Base*)client_data)->DoIt(); }
};

Base<void> test;   // legal?

This is to be used in a general template class for callback functionality.

Another question while I am at it:

I believe that a static member function had no guarantee that the linkage
was the same as for C-functions. Is that still so, according to the upcoming
standard?

/jorma
jorma.tolonen@mailbox.swipnet.se


[ 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: <41g21e$o4f@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: jorma.tolonen@mailbox.swipnet.se (Jorma Tolonen)
Newsgroups: comp.std.c++
Subject: void as template argument
Date: 23 Aug 1995 20:11:26 GMT
Organization: ?
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <41g21e$o4f@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text/plain; charset="us-ascii"
X-Mailer: <PC Eudora Version 1.4b22>
X-Lines: 25
Content-Length: 603
Originator: clamage@taumet