令人困惑的尖括号 <something> 在 c++ 中
Confusing Angle Brackets < something > in c++
我是从 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
的作用。
您正在查看 C++ templates。
...allows a function or class to work on many different data types without being rewritten for each one.
我是从 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
的作用。
您正在查看 C++ templates。
...allows a function or class to work on many different data types without being rewritten for each one.