File: templates.cpp

package info (click to toggle)
kdevelop 4%3A5.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,356 kB
  • ctags: 23,249
  • sloc: cpp: 160,775; python: 2,137; lex: 621; ansic: 617; sh: 577; xml: 142; ruby: 120; makefile: 52; php: 12; sed: 12
file content (68 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/// "toString" : "struct myTemplate< T >",
/// "kind" : "Type"
template<class T>
struct myTemplate {};

/// "toString" : "struct myTemplateChild",
/// "kind" : "Type"
struct myTemplateChild : myTemplate<int> { };

// Test for CXType_DependentSizedArray
template<typename T>
struct Class
{
    /// "toString" : "char[] data"
    char data[10 * sizeof(T)];
};

/// "toString" : "struct Class_volatile_const< T >"
template<typename T>
struct Class_volatile_const
{};

/// "toString" : "class TemplateTest< T, i >"
template <typename T, int i = 100>
class TemplateTest
{};

/// "toString" : "class Partial< Foo >"
template<typename Foo>
class Partial : TemplateTest<Foo, 42> {};

/// "toString" : "class VariadicTemplate< T, Targs >"
template<typename T, typename... Targs>
class VariadicTemplate {};

/// "type" : { "toString" : "Class_volatile_const< int >" }
Class_volatile_const<int> instance;

/// "type" : { "toString" : "VariadicTemplate< int, double, bool >", "EXPECT_FAIL": {"toString": "No way to get variadic template arguments with LibClang"} }
VariadicTemplate<int, double, bool> variadic;

/// "type" : { "toString" : "TemplateTest< const TemplateTest< int, 100 >, 30 >" }
TemplateTest<const TemplateTest<int, 100>, 30> tst;

/// "toString" : "void test< Type >()",
/// "EXPECT_FAIL": {"toString": "No way to get template parameters with libclang, and display name would duplicate the signature"}
template<class Type>
void test()
{
    /// "type" : { "toString" : "const volatile auto" }
    const volatile auto type = Type();
}

namespace Foo {
/// "toString" : "struct Bar< T >"
template<typename T>
struct Bar {
    /// "toString" : "class Nested< T2 >"
    template<typename T2>
    class Nested {};
};
}

/// "type" : {
///     "toString" : "Foo::Bar< int >::Nested< float >",
///     "EXPECT_FAIL": {"toString": "The parent specialization information is lost, i.e. Bar<int> becomes Bar<T>"}
/// }
Foo::Bar<int>::Nested<float> asdf;