2017-03-05 22:49:23 +00:00
|
|
|
template<typename T>
|
|
|
|
static int foo() {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
int a = foo<int>();
|
|
|
|
int b = foo<bool>();
|
|
|
|
|
|
|
|
// TODO: put template foo inside a namespace
|
|
|
|
// TODO: put template foo inside a template class inside a namespace
|
|
|
|
|
|
|
|
/*
|
|
|
|
OUTPUT:
|
|
|
|
{
|
2017-12-12 05:15:37 +00:00
|
|
|
"includes": [],
|
|
|
|
"skipped_by_preprocessor": [],
|
|
|
|
"types": [],
|
2017-03-07 18:17:49 +00:00
|
|
|
"funcs": [{
|
2017-03-05 22:49:23 +00:00
|
|
|
"id": 0,
|
2017-12-02 01:07:03 +00:00
|
|
|
"is_operator": false,
|
2017-03-05 22:49:23 +00:00
|
|
|
"usr": "c:template_func_usage_folded_into_one.cc@FT@>1#Tfoo#I#",
|
|
|
|
"short_name": "foo",
|
2017-04-15 04:58:07 +00:00
|
|
|
"detailed_name": "int foo()",
|
2017-12-12 05:15:37 +00:00
|
|
|
"declarations": [],
|
2017-04-05 08:29:15 +00:00
|
|
|
"definition_spelling": "2:12-2:15",
|
|
|
|
"definition_extent": "2:1-4:2",
|
2017-12-19 06:15:46 +00:00
|
|
|
"base": [],
|
2017-12-12 05:15:37 +00:00
|
|
|
"derived": [],
|
|
|
|
"locals": [],
|
|
|
|
"callers": ["-1@6:9-6:12", "-1@7:9-7:12"],
|
|
|
|
"callees": []
|
2017-03-05 22:49:23 +00:00
|
|
|
}],
|
2017-03-07 18:17:49 +00:00
|
|
|
"vars": [{
|
2017-03-05 22:49:23 +00:00
|
|
|
"id": 0,
|
|
|
|
"usr": "c:@a",
|
|
|
|
"short_name": "a",
|
2017-04-15 04:58:07 +00:00
|
|
|
"detailed_name": "int a",
|
2017-04-05 08:29:15 +00:00
|
|
|
"definition_spelling": "6:5-6:6",
|
|
|
|
"definition_extent": "6:1-6:19",
|
2017-05-21 01:26:50 +00:00
|
|
|
"is_local": false,
|
2017-06-29 06:25:19 +00:00
|
|
|
"is_macro": false,
|
2017-12-23 15:36:08 +00:00
|
|
|
"is_global": true,
|
2017-12-23 02:10:23 +00:00
|
|
|
"is_member": false,
|
2017-04-05 08:29:15 +00:00
|
|
|
"uses": ["6:5-6:6"]
|
2017-03-05 22:49:23 +00:00
|
|
|
}, {
|
|
|
|
"id": 1,
|
|
|
|
"usr": "c:@b",
|
|
|
|
"short_name": "b",
|
2017-04-15 04:58:07 +00:00
|
|
|
"detailed_name": "int b",
|
2017-04-05 08:29:15 +00:00
|
|
|
"definition_spelling": "7:5-7:6",
|
|
|
|
"definition_extent": "7:1-7:20",
|
2017-05-21 01:26:50 +00:00
|
|
|
"is_local": false,
|
2017-06-29 06:25:19 +00:00
|
|
|
"is_macro": false,
|
2017-12-23 15:36:08 +00:00
|
|
|
"is_global": true,
|
2017-12-23 02:10:23 +00:00
|
|
|
"is_member": false,
|
2017-04-05 08:29:15 +00:00
|
|
|
"uses": ["7:5-7:6"]
|
2017-03-05 22:49:23 +00:00
|
|
|
}]
|
|
|
|
}
|
2017-03-07 18:17:49 +00:00
|
|
|
*/
|