令人困惑的角括号<的东西>在c ++中

时间:2017-03-22 20:33:05

标签: c++ brackets

我来自c到c ++,熟悉语法。但我刚刚遇到了语法不熟悉的代码

int main() {
    std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
    std::shared_ptr<HelloWorldProxy<>> myProxy =
        runtime->buildProxy<HelloWorldProxy>("local", "test");

有人可以解释语法something < something > something对语法something<something<>> something的作用吗。

1 个答案:

答案 0 :(得分:4)

您正在查看C++ templates

  

...允许函数或类处理许多不同的数据类型,而不是为每个数据类型重写。