Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
CLASS_PARTIAL_SPEC.cpp
Go to the documentation of this file.
1
// checking partial template specialization
2
3
25
// primary template
26
template
<
class
T,
class
U>
27
struct
PartiallySpecialized
28
{
29
enum
{
e
= 0 };
30
};
31
32
// required by std::vector<bool>
33
template
<
class
U>
34
struct
PartiallySpecialized
<int,
U
>
35
{
36
enum
{
f
= 1 };
37
};
38
39
// required by std::iterator_traits
40
template
<
class
U>
41
struct
PartiallySpecialized
<int,
U
*>
42
{
43
enum
{
g
= 2 };
44
};
45
46
// required by std::iterator_traits
47
template
<
class
U>
48
struct
PartiallySpecialized
<int, const
U
*>
49
{
50
enum
{ h = 3 };
51
};
52
53
// required by std::allocator<const T>
54
template
<
class
T,
class
U>
55
struct
PartiallySpecialized
<const
T
, const
U
>
56
{
57
enum
{
i
= 4 };
58
};
59
60
// required by __rw_is_same
61
// exercises bug 638 in SunPro 5.7, patch 117831-02 2005/03/30
62
template
<
class
T>
63
struct
PartiallySpecialized
<
T
,
T
>
64
{
65
enum
{
j
= 5 };
66
};
67
68
// compile only, do not link
69
int
foo
()
70
{
71
#define PS PartiallySpecialized
72
73
return
!( 0 == PS<char, int>::e
74
&& 1 == PS<int, char>::f
75
&& 2 == PS<int, char*>::g
76
&& 3 == PS<int, const char*>::h
77
&& 4 == PS<const int, const char>::i
78
&& 5 == PS<long, long>::j);
79
}
i
#define i
Definition
17.names.cpp:126
T
#define T
Definition
17.names.cpp:163
g
#define g
Definition
17.names.cpp:120
f
#define f
Definition
17.names.cpp:119
j
#define j
Definition
17.names.cpp:127
U
#define U
Definition
17.names.cpp:164
foo
int foo()
Definition
CLASS_PARTIAL_SPEC.cpp:69
PartiallySpecialized
Definition
CLASS_PARTIAL_SPEC.cpp:28
PartiallySpecialized::e
@ e
Definition
CLASS_PARTIAL_SPEC.cpp:29
Generated by
1.9.8