Topic: Having a "extern C" template alias?


Author: "Johannes Schaub (litb)" <schaub-johannes@web.de>
Date: Sat, 29 May 2010 15:30:50 CST
Raw View
I wonder whether it makes sense and whether it would work to write the
following

extern "C" {
 template<typename R, typename ...P>
 using extern_C = R(P...);
}

So that you could for example write

void f(extern_C<void, int> *fp);

And that this would be equivalent to

extern "C" void extern_C(int);
void f(extern_C *fp);

That would allow to create extern-C function types on the fly, useful for
casting or such.

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]