Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
CLASS_PARTIAL_SPEC.cpp
Go to the documentation of this file.
1// checking partial template specialization
2
3
25// primary template
26template <class T, class U>
28{
29 enum { e = 0 };
30};
31
32// required by std::vector<bool>
33template <class U>
35{
36 enum { f = 1 };
37};
38
39// required by std::iterator_traits
40template <class U>
42{
43 enum { g = 2 };
44};
45
46// required by std::iterator_traits
47template <class U>
48struct PartiallySpecialized<int, const U*>
49{
50 enum { h = 3 };
51};
52
53// required by std::allocator<const T>
54template <class T, class U>
55struct 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
62template <class T>
64{
65 enum { j = 5 };
66};
67
68// compile only, do not link
69int 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}
#define i
Definition 17.names.cpp:126
#define T
Definition 17.names.cpp:163
#define g
Definition 17.names.cpp:120
#define f
Definition 17.names.cpp:119
#define j
Definition 17.names.cpp:127
#define U
Definition 17.names.cpp:164
int foo()