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
EXTERN_TEMPLATE.cpp
Go to the documentation of this file.
1
// checking for extern template extension
2
3
25
// include a file containing the definition of a template
26
// and an extern template directive referencing an explicit
27
// instantiation of the same template in extern_template_imp.o
28
29
#include "
extern_template_imp.h
"
30
31
// establish a dependency on extern_template_imp.o to make sure
32
// the extern_template_imp.cpp is compiled before this file
33
#ifndef _RWSTD_NO_extern_template_imp
34
35
// link with the object file below
36
// LDOPTS = extern_template_imp.o
37
38
#endif
// _RWSTD_NO_extern_template_imp
39
40
int
main
()
41
{
42
// each of the member function of S<int> is defined to return 1
43
// when explicitly instantiated in extern_template_imp.cpp but
44
// to return 0 when #included here
45
46
S<int>
s
;
47
48
int
res
= 0;
49
50
// verify that calls to inline member functions defined in
51
// the body of the template, inline member functions defined
52
// outside the body of the template, and out-of-line member
53
// functions all compile and link
54
res
+=
s
.
foo
();
55
res
+=
s
.bar ();
56
res
+=
s
.baz ();
57
58
// verify that the calls ultimately resolve to the definition
59
// emitted by the explicit instantiation in extern_template_imp.o
60
// and not the one here
61
return
!(3 ==
res
);
62
}
res
#define res
Definition
17.names.cpp:531
s
#define s
Definition
rw_alg_test.h:221
main
int main()
Definition
EXTERN_TEMPLATE.cpp:40
extern_template_imp.h
S
Definition
COLLAPSE_TEMPLATE_STATICS.cpp:40
S::foo
T foo() const
Definition
extern_template_imp.h:66
Generated by
1.9.8