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. paddlepaddle初步印象

    从其官网整理了一些资料如下: 1.基本概念 基本使用概念 PaddlePaddle是源于百度的一个深度学习平台.PaddlePaddle为深度学习研究人员提供了丰富的API,可以轻松地完成神经网络配置 ...

  2. postfix邮件服务器搭建01-准备篇

    本系列文章主要介绍linux下主流的开源邮件系统postfix的搭建过程,构建一个通过postfix虚拟用户管理的完整的邮件系统, 该系统包括以下组件: 邮件收发端postfix,dovecot, 邮 ...

  3. ubuntu版的sublime-text3输入中文问题

    前言 sublime-text3中看又中用,但是呢,ubuntu下有个问题,就是无法输入中文.这很难受啊,要写一些重要的内容时,总还是中文来的顺畅. 解决办法 工具:sublime-text-imfi ...

  4. Django项目部署(阿里云)(2)--扩展

    新博客地址:http://muker.net/django-server-two.html 前面的只是最简单的部署,真实情况总是更复杂一点实际流程大概是这么操作的(我这种菜鸟的想法):本地写代码-&g ...

  5. 解决form嵌套

    自己的尝试功能实现了 但是项目中没有使用: 思路利用ajax:第一个form提交的时候触发第二个需要提交数据的ajax的请求url function checkform(type){ var issu ...

  6. 何时使用padding和margin

    先看看这张图: 重点其实是background-image CSS边距属性定义元素周围的空间.通过使用单独的属性,可以对上.右.下.左的外边距进行设置.也可以使用简写的外边距属性同时改变所有的外边距. ...

  7. Luogu P2742 模板-二维凸包

    Luogu P2742 模板-二维凸包 之前写的实在是太蠢了.于是重新写了一个. 用 \(Graham\) 算法求凸包. 注意两个向量 \(a\times b>0\) 的意义是 \(b\) 在 ...

  8. BZOJ3673 可持久化并查集 by zky 【主席树】

    BZOJ3673 可持久化并查集 by zky Description n个集合 m个操作 操作: 1 a b 合并a,b所在集合 2 k 回到第k次操作之后的状态(查询算作操作) 3 a b 询问a ...

  9. Redis缓存的设计、性能、应用与数据集群同步

    Redis缓存的设计.性能.应用与数据集群同步 http://youzhixueyuan.com/design-performance-and-application-of-redis-cache.h ...

  10. hadoop入门手册3:Hadoop【2.7.1】初级入门之命令指南

    问题导读1.hadoop daemonlog管理员命令的作用是什么?2.hadoop如何运行一个类,如何运行一个jar包?3.hadoop archive的作用是什么? 概述 hadoop命令被bin ...