Confusing Angle Brackets < something > in c++

牧云@^-^@ 提交于 2020-04-05 05:24:33

问题


I am coming from c to c++ and familiar with the syntax. But I just came across the code with syntax im not familiar with

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

Can Someone explain what does syntax something < something > something do also what does syntax something<something<>> something do.


回答1:


You're looking at C++ templates.

...allows a function or class to work on many different data types without being rewritten for each one.



来源:https://stackoverflow.com/questions/42962113/confusing-angle-brackets-something-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!