home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_12
/
pugh
/
preproc.cpp
< prev
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1993-10-10
|
304 b
|
22 lines
Listing 3
template <const int i>
class INTEGER
{
#if i == O
int val;
#elif i == 1
char val;
#elif i == 2
long val;
#endif
};
should yield:
INTEGER<0> two_bytes;
INTEGER<1> one_byte;
INTEGER(2) four_bytes;
//sizeof OPERATOR SHOWS THAT EVERY INSTANTIATION OF val IS OF
TYPE int.