【问题标题】:What does the declaration "String^ strtests" in C++/CLI mean?C++/CLI 中的“String^ strtests”声明是什么意思?
【发布时间】:2016-03-04 11:01:49
【问题描述】:

我只是被下面的语法弄糊涂了:

T1<T2^>^ templatetest;
Sting^ strtest;
[this]()->...

【问题讨论】:

  • 这不是“干净的”C++,而是C++/CLI
  • @Adam 这在 C++ 中没有任何意义。它在 C++/CLI 中可能有意义,但 C++/CLI 不是 C++。从来都不是。

标签: c++ .net templates declaration managed-c++


【解决方案1】:

C++/CLI 中的^ 类似于 C++ 中的*。使用^ 声明并由gcnew 分配的对象将存储在托管内存中并自动释放,然后该内存上的指针数变为0。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多