Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
extern_template_imp.h
Go to the documentation of this file.
1
2
24// avoid including <config.h> here to avoid inadvertently
25// trying to introduce dependencies on other config tests
26// that the config infrastructure won't know about (since
27// it only searches .cpp files for them)
28// #include <config.h>
29
30#if __GNUG__ >= 3
31 // disable gcc 3.x (and beyond) error: ISO C++ forbids the use
32 // of `extern' on explicit instantiations
33# pragma GCC system_header
34#endif // gcc >= 3
35
36
37template <class T>
38struct S
39{
40 T t;
41
42 T foo () const;
43
44 T bar () const;
45
46 T baz () const {
47 return bar ();
48 }
49
50 template <class U>
52 return U ();
53 }
54
55 template <class U>
57};
58
59template <class T>
60inline T S<T>::bar () const
61{
62 return foo ();
63}
64
65template <class T>
66T S<T>::foo () const
67{
68#if defined (INSTANTIATE)
69 return 1;
70#else // if !defined (INSTANTIATE)
71 return 0;
72#endif // INSTANTIATE
73}
74
75template <class T>
76template <class U>
78{
79 return U ();
80}
81
82
83#if defined (INSTANTIATE)
84
85template struct S<int>;
86
87#else // if !defined (INSTANTIATE)
88
89extern template struct S<int>;
90
91#endif // INSTANTIATE
#define T
Definition 17.names.cpp:163
#define t
Definition 17.names.cpp:136
#define U
Definition 17.names.cpp:164
#define foo(buf, s,...)
T baz() const
U inline_member_template(U) const
T foo() const
U member_template(U) const
T bar() const