在Visual C ++使用^运算符++ [英] Use of ^ operator in visual c++

查看:170
本文介绍了在Visual C ++使用^运算符++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做的Visual C ++编程,我创建了一个CLR控制台应用程序。我注意到字符串数组应该如String声明^,不是的String []。有什么用^吗?为什么它被用来代替[]?而就是这种替代仅限于CLR应用程序?
这里是code的线和错误:

I am doing Visual c++ programming, I have created a CLR console application. I have noticed that String arrays should be declared like String ^, not String[]. What is the use of ^? And why is it being used instead of []? And is this substitution limited only to CLR applications? Here is a line of the code and the error:

array<String[]>[] abc;

所产生的误差为

错误C2143:语法错误:缺少;前[

error C2143: syntax error : missing ';' before '['

错误C2146:语法错误:缺少;符前ABC

error C2146: syntax error : missing ';' before identifier 'abc'

eror C2065:'ABC':未声明的标识符

eror C2065: 'abc' : undeclared identifier

推荐答案

抑扬口音意味着该对象是一个托管指针,它会被垃圾收集器自动收集 - 你不需要含蓄地做到这一点。
请看看这篇文章了解数组用C如何工作++ / CLI。

The circumflex accent means that the object is a managed pointer,it'll be automatically collected by the Garbage Collector - you don't need to do this implicitly. Please take a look at this article to understand how arrays work in C++/CLI.

在您的情况:

array<String^> ^abc;

,是这次换人仅仅限于CLR应用程序?

这篇关于在Visual C ++使用^运算符++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆