This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Stupid typedef question / g++
- From: John Love-Jensen <eljay at adobe dot com>
- To: SA <bullet dot train at ntlworld dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Fri, 24 Jan 2003 11:02:22 -0600
- Subject: Re: Stupid typedef question / g++
Hi SA,
No, that will not work. C++ does not have an "explicit typedef", rather it
has an aliasing typedef.
You can do something like this:
struct TYPE1 { int m; TYPE1(int in) : m(in) {} };
struct TYPE2 { int m; TYPE2(int in) : m(in) {} };
void test(TYPE1);
void test(TYPE2);
...et cetera. You can add more convenience routines to the two types, to
make them spoof "being an int" as much as you require.
--Eljay