无处不在,我需要使用std :: [英] everywhere, i need to use std::

查看:100
本文介绍了无处不在,我需要使用std ::的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[1]使用命名空间std


在我的C ++程序中,即使应用了[1],我也需要使用std

命名空间范围分辨率运算符,比如,std :: cout,

std :: vector。我发现有点累赘总是包括

std。


我找到了解决这个问题的技巧。使用std :: cout使用


;

使用std :: vector;


而不是使用[ 1]。


它总是这样做,还是还有其他概念,我仍然不知道。


问候,

vijay。

[1] using namespace std

In my C++ program, even after applying [1], I need to use the std
namespace with the scope resolution operator, like, std::cout,
std::vector. This I found a little bit cumbersome to always include
std.

I somewhere found a trick to overcome this problem. By using

using std::cout;
using std::vector;

rather than using [1].

is it always done like this or is there any other concept that I still
do not know.

regards,
vijay.

推荐答案

您只需添加声明:


使用std;


然后你可以直接使用cout,vector等。


Deepa

-

EventStudio 2.5 - http:// www。 EventHelix.com/EventStudio

以纯文本形式输入模型;以PDF / Word格式生成序列图

You can just add the statement:

using std;

Then you can use cout, vector etc. directly.

Deepa
--
EventStudio 2.5 - http://www.EventHelix.com/EventStudio
Enter model in plain text;generate sequence diagram in PDF/Word


drdoubt写道:
drdoubt wrote:
[1]使用命名空间std


使用命名空间std;


在我的C ++程序,即使在应用[1]之后,我还需要使用带有范围解析的std
命名空间n运算符,比如,std :: cout,
std :: vector。我发现总是包含
标准有点麻烦。

我找到了解决这个问题的技巧。使用std :: cout;
使用std :: vector;

而不是使用[1]。

是它总是这样做或者是否还有其他我不知道的概念。
[1] using namespace std
using namespace std;

In my C++ program, even after applying [1], I need to use the std
namespace with the scope resolution operator, like, std::cout,
std::vector. This I found a little bit cumbersome to always include
std.

I somewhere found a trick to overcome this problem. By using

using std::cout;
using std::vector;

rather than using [1].

is it always done like this or is there any other concept that I still
do not know.



如果你使用命名空间std;在作用域的开头,

没有用于该作用域中的显式作用域解析。

例如,以下内容应该与编译器成功编译:

#include< iostream>

int main()

{

使用命名空间std;


cout<<"" Hello world!\ n";

}


-

Ioannis Vranos

http://www23.brinkster.com/noicys


EventHelix.com写道:
EventHelix.com wrote:
你可以加上声明:

使用std;

然后你可以直接使用cout,vector等。
You can just add the statement:

using std;

Then you can use cout, vector etc. directly.



使用命名空间std;


-

Ioannis Vranos

http: //www23.brinkster.com/noicys


这篇关于无处不在,我需要使用std ::的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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