Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confusing Angle Brackets < something > in c++

Tags:

c++

brackets

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.

like image 780
gfdsal Avatar asked Mar 22 '17 20:03

gfdsal


1 Answers

You're looking at C++ templates.

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

like image 104
Alex Taylor Avatar answered Sep 30 '22 10:09

Alex Taylor