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 ...
随机推荐
- Android开发:碎片Fragment完全解析fragment_main.xml/activity_main.xml(转)
注明:这个转的,见谅未能标明原始出处 我们都知道,Android上的界面展示都是通过Activity实现的,Activity实在是太常用了,我相信大家都已经非常熟悉了,这里就不再赘述. 但是Activ ...
- Linux 输入子系统
Technorati 标签: Kernel 输入子系统 Input 在Linux中,输入设备(如按键.键盘.触摸屏.鼠标等)是典型的字符设备,其一般的工作机理,是底层在按键.触摸时,触发一个 ...
- Python单元测试——深入理解unittest (转)
单元测试的重要性就不多说了,可恶的是Python中 有太多的单元测试框架和工具,什么unittest, testtools, subunit, coverage, testrepository, no ...
- Linux上iptables防火墙的基本应用
1.安装iptables防火墙 yum install iptables -y 2. 清除已有的iptables规则 iptables -F iptables -X iptables -Z 3.显示i ...
- php更新修改excel中的内容例子
代码如下 复制代码 //模板存放目录$dir = $DOCUMENT_ROOT.'/backoffice/admin/oemcheck/'; $templateName = '1.xlsx';$ou ...
- 基于PinnedSectionListView实现联系人通讯录并且点击打电话
PinnedSectionListView具体下载地址.使用方法和注意事项:http://www.cnblogs.com/zzw1994/p/4997601.html 怎么根据联系人姓名首字符顺序读取 ...
- 删除mysql的root用户恢复方法
1.# service mysqld stop #停止mysql数据库服务Shutting down MySQL.. SUCCESS! 2.# ...
- VirtualBox虚拟机安装MSDOS和MINIX2.0.0双系统
1. 在VirtualBox中新建一个MSDOS虚拟机. 2.下载一个MSDOS软盘镜像. 3.启动虚拟机,提示选择安装盘时,选择步骤2下载过来的MSDOS镜像. 4.正常启动进入DOS命令行,用FD ...
- 常见前端面试题之HTML/CSS部分
转自http://www.cnblogs.com/jscode/archive/2012/07/10/2583856.html Doctype是什么?如何触发严格模式与混杂模式模式?区分它们有何意义? ...
- [ios]ipad下的splitViewController 让你的APP看起来酷酷的!
在ipad下可以使用splitViewController splitViewController下包含两个viewController 这是一种将屏幕一分为二的方式. 在水平状态下会出现成两个左右两 ...