| 1 |
template<typename T> |
| 2 |
static int foo() { |
| 3 |
return 3; |
| 4 |
} |
| 5 |
|
| 6 |
int a = foo<int>(); |
| 7 |
int b = foo<bool>(); |
| 8 |
|
| 9 |
// TODO: put template foo inside a namespace |
| 10 |
// TODO: put template foo inside a template class inside a namespace |
| 11 |
|
| 12 |
/* |
| 13 |
OUTPUT: |
| 14 |
{ |
| 15 |
"includes": [], |
| 16 |
"skipped_ranges": [], |
| 17 |
"usr2func": [{ |
| 18 |
"usr": 326583651986177228, |
| 19 |
"detailed_name": "static int foo()", |
| 20 |
"qual_name_offset": 11, |
| 21 |
"short_name": "foo", |
| 22 |
"spell": "2:12-2:15|2:1-4:2|2|-1", |
| 23 |
"bases": [], |
| 24 |
"vars": [], |
| 25 |
"callees": [], |
| 26 |
"kind": 12, |
| 27 |
"parent_kind": 1, |
| 28 |
"storage": 0, |
| 29 |
"declarations": [], |
| 30 |
"derived": [], |
| 31 |
"uses": ["6:9-6:12|36|-1", "7:9-7:12|36|-1"] |
| 32 |
}], |
| 33 |
"usr2type": [{ |
| 34 |
"usr": 452, |
| 35 |
"detailed_name": "", |
| 36 |
"qual_name_offset": 0, |
| 37 |
"short_name": "", |
| 38 |
"bases": [], |
| 39 |
"funcs": [], |
| 40 |
"types": [], |
| 41 |
"vars": [], |
| 42 |
"alias_of": 0, |
| 43 |
"kind": 0, |
| 44 |
"parent_kind": 0, |
| 45 |
"declarations": [], |
| 46 |
"derived": [], |
| 47 |
"instances": [16721564935990383768, 12028309045033782423], |
| 48 |
"uses": [] |
| 49 |
}, { |
| 50 |
"usr": 17666708977284229997, |
| 51 |
"detailed_name": "T", |
| 52 |
"qual_name_offset": 0, |
| 53 |
"short_name": "", |
| 54 |
"bases": [], |
| 55 |
"funcs": [], |
| 56 |
"types": [], |
| 57 |
"vars": [], |
| 58 |
"alias_of": 0, |
| 59 |
"kind": 26, |
| 60 |
"parent_kind": 0, |
| 61 |
"declarations": ["1:19-1:20|1:10-1:20|1|-1"], |
| 62 |
"derived": [], |
| 63 |
"instances": [], |
| 64 |
"uses": [] |
| 65 |
}], |
| 66 |
"usr2var": [{ |
| 67 |
"usr": 12028309045033782423, |
| 68 |
"detailed_name": "int b", |
| 69 |
"qual_name_offset": 4, |
| 70 |
"short_name": "b", |
| 71 |
"hover": "int b = foo<bool>()", |
| 72 |
"spell": "7:5-7:6|7:1-7:20|2|-1", |
| 73 |
"type": 452, |
| 74 |
"kind": 13, |
| 75 |
"parent_kind": 1, |
| 76 |
"storage": 0, |
| 77 |
"declarations": [], |
| 78 |
"uses": [] |
| 79 |
}, { |
| 80 |
"usr": 16721564935990383768, |
| 81 |
"detailed_name": "int a", |
| 82 |
"qual_name_offset": 4, |
| 83 |
"short_name": "a", |
| 84 |
"hover": "int a = foo<int>()", |
| 85 |
"spell": "6:5-6:6|6:1-6:19|2|-1", |
| 86 |
"type": 452, |
| 87 |
"kind": 13, |
| 88 |
"parent_kind": 1, |
| 89 |
"storage": 0, |
| 90 |
"declarations": [], |
| 91 |
"uses": [] |
| 92 |
}] |
| 93 |
} |
| 94 |
*/ |