If we want to use cin in the standard library, we need to

std::cin

To simplify this work, we can do like this

using namespace::name;

  

* Headers should not include using Declarations

Why?

The reason is that the contents of a header are copied into the including program's text. It's likely to encounter unexpected name conflicts.

[Cpp primer] Namespace using Declarations的更多相关文章

  1. [Cpp primer] Library vector Type

    #include<vector> using std::vector; //Vector is a container. //It has a collection of same typ ...

  2. [Cpp primer] Library string Type

    In order to use string type, we need to include the following code #include<string> using std: ...

  3. [Cpp primer] range for (c++11)

    for (declaration : expression) statement; /* This statement will iterate through the elements in the ...

  4. C++primer学习笔记(一)——Chapter 3

    3.1 Namespace using Declarations 1.因为C++里有名字空间的定义,例如我们使用cin的时候必须写成std::cin,如果就用一次还是可以接受的,但是如果一直都这样,那 ...

  5. c++ namespace命名空间详解

    What is a namespace? A namespace defines an area of code in which all identifiers are guaranteed to ...

  6. C++ 名字空间namespace的使用

    A namespace is a scope.C++ provides namespaces to prevent name conflicts.A namespace is a mechanism ...

  7. 《C++ Primer》学习总结;兼论如何使用'书'这种帮助性资料

    6.25~ 6.27,用了3天翻了一遍<C++ Primer>. ▶书的 固有坏处 一句话: 代码比 文字描述 好看多了.————> 直接看习题部分/ 看demo就行了 看文字在描述 ...

  8. namespace的作用

    namespace的用法 1.什么是命名空间 通常我们学c++的时候经常看见头文件下有一句using namespace std,有什么用呢? 例如: #include<iostream> ...

  9. C++/CLI中class成员声明与实现分开在不同文件时必须添加namespace

    以下是我的代码: //TaskConfigFile.h #pragma once using namespace System::Collections::Generic; using namespa ...

随机推荐

  1. BASE理论

    BASE是Basiclly Available(基本可用),Soft state(软状态),Eventually consistent(最终一致性)三个短语的缩写. BASE是对CAP中一致性和可用性 ...

  2. React-Native基础_3.Flex布局

    Flex布局介绍 /** * Sample React Native App * https://github.com/facebook/react-native * @flow */ 'use st ...

  3. Swift 3 点击屏幕任意位置隐藏键盘

    func hideKeyboardWhenTappedAround() { let tap: UITapGestureRecognizer = UITapGestureRecognizer(targe ...

  4. 特殊的 html 空格

    http://www.zhangxinxu.com/wordpress/2015/01/tips-blank-character-chinese-align/

  5. scrollTop兼容处理

    使用jQuery2.0以下版本的scrollTop()函数来设置当然兼容性当然很好,但有时需要为滚动设置滑动效果.比如,使用animate函数,这里需要做些兼容性处理: 实例:http://sandb ...

  6. appium-java,切换源生app和webview

    方法 public void swith_app(AndroidDriver AndroidDriver){ //切换到源生app System.out.println(AndroidDriver.g ...

  7. [Scala函数特性系列]——按名称传递参数

    通常情况下,函数的参数是传值参数:即参数的值在它被传递给函数之前被确定.但是,如果我们需要编写一个接收参数不希望马上计算,直到调用函数内的表达式才进行真正的计算的函数.对于这种情况,Scala提供按名 ...

  8. Django基于Form之登录和注册

    1.创建Forms文件,内容略多,大家将就着看,不懂请留言 #!/usr/bin/env python # -*- coding: utf8 -*- #__Author: "Skiler H ...

  9. modsecurity3.0 nginx 安装

    备注: 使用的是modsecurity 3.0 的版本,也是nginx 官方推荐使用的,同时使用的是nginx 的dynamic module 1. 环境准备 https://github.com/S ...

  10. Google、IBM和Lyft开源其大型微服务系统管理工具Istio

    Istio 的优势 集群规模可视性:在故障状况出现时,运营人员需要利用多种工具以始终关注集群运行状况并分析微服务状态图表.Istio 项目能够监控与应用程序及网络活动相关的数据,利用 Promethe ...