Debian Codegraph @

pypy/module/_cppyy/test/templates.cxx

raw symbols SCIP
1 #include "templates.h"
2
3
4 // template methods
5 long MyTemplatedMethodClass::get_size() { return -1; }
6
7 long MyTemplatedMethodClass::get_char_size() { return (long)sizeof(char); }
8 long MyTemplatedMethodClass::get_int_size() { return (long)sizeof(int); }
9 long MyTemplatedMethodClass::get_long_size() { return (long)42; /* "lying" */ }
10 long MyTemplatedMethodClass::get_float_size() { return (long)sizeof(float); }
11 long MyTemplatedMethodClass::get_double_size() { return (long)sizeof(double); }
12 long MyTemplatedMethodClass::get_self_size() { return (long)sizeof(MyTemplatedMethodClass); }
13
14
15 // variadic templates
16 #ifdef WIN32
17 __declspec(dllexport)
18 #endif
19 std::string some_variadic::gTypeName = "";
20
21
22 // template with empty body
23 namespace T_WithEmptyBody {
24
25 #ifdef WIN32
26 __declspec(dllexport)
27 #endif
28 std::string side_effect = "not set";
29
30 template<typename T>
31 void some_empty() {
32 side_effect = "side effect";
33 }
34
35 template void some_empty<int>();
36
37 } // namespace T_WithRValue
38
39
40 // The following is hidden from the Cling interpreter, but available to the
41 // linker; it allows for testing whether a function return is picked up from
42 // the compiled instantation or from the interpreter.
43
44 namespace FailedTypeDeducer {
45
46 template<class T>
47 class A {
48 public:
49 T result() { return T{42}; }
50 };
51
52 template class A<int>;
53
54 template class B<int>;
55
56 } // namespace FailedTypeDeducer