template & void argument

From: Manuel Maria Diaz Gomez (Manuel.Maria.Diaz.Gomez_at_cern.ch)
Date: 04/29/04


Date: Thu, 29 Apr 2004 12:07:17 +0200

Thanks Victor for your previous answer!

I have the following problem:

I would like to implement an interface class that defines a pure virtual
method that could take any parameter as input, void inlcuded.
The first idea was to use a template, but in that case void is not admited
as a type right?

i.e.
template<typename T>
class A {

virtual do_something(T) = 0;

};

Then, one of the derive classes can't just do :

do_something(){...}

Because the compiler will complain for void not being a type...

Any work-around this?

Cheers

Manuel

-- 
========================================================================
Manuel Diaz-Gomez   | ATLAS    Bldg. 32/SB-008   tel. +41 22 76 76304
CERN EP Division
CH-1211 Geneva 23
SWITZERLAND
========================================================================


Relevant Pages

  • Interface stuff does not compile
    ... void m2; ... virtual void m2 ... Si de pronto se descompusieran todos los televisores del mundo, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Interface stuff does not compile
    ... void m2; ... members are private by default in a ref class. ... virtual void m2 ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Interface stuff does not compile
    ... the way to uncomment second "void m" is to rename virtual ... virtual void i2::m ... you can also provide a private implementation. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: template & void argument
    ... >I would like to implement an interface class that defines a pure virtual ... >method that could take any parameter as input, void inlcuded. ... >The first idea was to use a template, but in that case void is not admited ... C++ FAQ: http://www.parashift.com/c++-faq-lite/ ...
    (comp.lang.cpp)
  • Re: pthread and select problem with pthread
    ... Manuel wrote: ... void *doit(void *arg) ... Do you use -pthread flag while compiling and linking with gcc? ...
    (comp.programming.threads)