Namespace, string, vector and array
1. Headers should not include using declaration
Code inside headers ordinarily should not include using declarations. The reason is that the contents of a header are copied into the including program's text. If a header has a using declaration, then every program that includes that header gets the same using declaration. As a result, a program that does not intend to use the specified library name might encounter unexpected name conflicts.
2. Deal with characters in string( with functions in <cctype> header)
isalnum(c): true if c is a letter or digit
isalpha(c): true if c is a letter
isdigit(c): true if c is a digit
islower(c): true if c is a lowercase letter
isspace(c): true if c is a whitesapce
isupper(c): true if c is an uppercase letter
tolower(c): return lowercase letter
toupper(c): return uppercase letter
3. Different between pointer and iterator
Pointer is a built-in type whereas iterator is a class. Pointer is avaiable for all type of objects whereas iterator is only available for containers.
4. Vector and array
Similarity: they all store a collection of variables of a single type and we can access their element by position.
Difference: elements in array is stored in continuous space whereas elements in vector can be stored in non-continuous space. Array is fixed size and we can't add or remove element from a array. On the contrary, the size of a vector can be changed by adding or removing elements from it.
4. There is no arrays of references
Namespace, string, vector and array的更多相关文章
- string,vector和array(C++ Primer读书笔记)
string string是标准库类型,使用时需要包涵头文件,使用using声明. include <string> using std::string; 1.定义和初始化 string ...
- C++ 标准库类型-String,Vector and Bitset
<C++ Primer 4th>读书摘要 最重要的标准库类型是 string 和 vector,它们分别定义了大小可变的字符串和集合.这些标准库类型是语言组成部分中更基本的那些数据类型(如 ...
- vector以及array和数组
//比较数组.vector.array #include <iostream> #include <vector> #include <array> #includ ...
- PAT 1039 Course List for Student (25分) 使用map<string, vector<int>>
题目 Zhejiang University has 40000 students and provides 2500 courses. Now given the student name list ...
- Swift3 - String 字符串、Array 数组、Dictionary 字典的使用
Swift相关知识,本随笔为 字符串.数组.字典的简单使用,有理解.使用错误的地方望能指正. ///************************************************** ...
- Vector, ArrayList, Array
JAVA新手在使用JAVA的时候大概都会遇到这个问题: JAVA中的Array, ArrayList, Vector, List, LinkedList有什么样的区别?尤其是Vector, Array ...
- perl malformed JSON string, neither tag, array, object, number, string or atom, at character offset
[root@wx03 ~]# cat a17.pl use JSON qw/encode_json decode_json/ ; use Encode; my $data = [ { 'name' = ...
- gitlab-ci.xml:script config should be a string or an array of strings
The following command in a job script: STATUS_ID=$(grep -Eo "Status Code [0-9]+: Done" som ...
- Java – How to convert String to Char Array
Java – How to convert String to Char ArrayIn Java, you can use String.toCharArray() to convert a Str ...
随机推荐
- Linux 静态库和动态库 使用说明
Linux下程序运行中,有两种库,静态库和动态库. 静态库:名字一般为libxxx.a,编译时会整合到可执行程序中,优点是运行时不需要外部函数库支持,缺点是编译后程序较大,一旦静态库改 ...
- win7局域网无法ping通本机的问题解决方法
对于window7系统,很多朋友会发现:默认下是不允许被ping的,其实都系统自带的防护墙所阻止了,新建一个策略就可以实现被ping通,如下操作
- CenterOS中安装Redis及开机启动设置
Redis安装 从官方下载最新Redis进行安装,官网地址:http://redis.io/download $ wget http://download.redis.io/releases/redi ...
- 节点属性(DOM对象)
节点属性 在文档对象模型 (DOM) 中,每个节点都是一个对象.DOM 节点有三个重要的属性 : 1. nodeName : 节点的名称 2. nodeValue :节点的值 3. nodeType ...
- Ajax和JavaScript的区别
javascript是一种在浏览器端执行的脚本语言,Ajax是一种创建交互式网页应用的开发技术 ,它是利用了一系列相关的技术其中就包括javascript.Javascript是由网景公司开发的一种脚 ...
- php + apache + mysql环境搭建
别人写的很好,若是不改变php默认访问路径的话,能够成功搭建是没问题的 http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html
- CLR via C# 线程基础知识读书笔记
1.线程的开销 a.线程内核对象 b.线程环境块 c.用户模式栈(1MB) d.内核模式栈 f.DLL线程连接和线程分离通知 2.线程的优先级由进程优先级和线程优先级共同组成 3.进程中所有的前台线程 ...
- Oracle bbed 实用示例-----File Header Reset
一.查看当前环境 1.1 当前控制文件中的SCN号 [oracle@ora10 ~]$ sqlplus /nolog SQL :: Copyright (c) , , Oracle. All righ ...
- Oracle 表的连接方式(1)-----Nested loop join和 Sort merge join
关系数据库技术的精髓就是通过关系表进行规范化的数据存储,并通过各种表连接技术和各种类型的索引技术来进行信息的检索和处理. 表的三种关联方式: nested loop:从A表抽一条记录,遍历B表查找匹配 ...
- linux终端io笔记
简介 终端的两种工作模式:以行为单位的工作模式,以字符数或时间为单位自定义模式 终端判断函数: int isatty(int fd) 终端属性的获取与设置: int tcgetattr(int fd, ...