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 ...
随机推荐
- Google面试题:计算从1到n的正数中1出现的次数
题目: 输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数.例如输入12,从1到12这些整数中包含1 的数字有1,10,11和12,1一共出现了5次. 找工作,准备看写题目,题目说是Goo ...
- 什么是WEB服务器?
简单的理解: 一个公用的服务器,你可以放置网站文件,让全世界浏览,可以放文件,全世界下载.web服务器一般指网站服务器. web服务器是基于网站架设的服务器,我们平时可以浏览的网页都是在别人的服务 ...
- HTML5-Geolocation&地图.html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- js学习笔记一数字
js所有数值都用浮点数来表示 十六进制数字以0x或者0X为前缀,由0-9,a-f(大小写均可)之间字符构成,a-f对应的数值是10-15 八进制数字以数字0开始,其后跟随0-7之间的数字,严格来说,j ...
- php win主机下实现ISAPI_Rewrite伪静态
有的win主机iss不支持 .htaccess 文件, 我在这里指的不是本地 在本地的话用apmserv服务器可以用.htaccess 文件,用apmserv服务器环境配置伪静态可以看 php 伪静态 ...
- Use a layout_width of 0dip instead of wrap_content for better performance.......【Written By KillerLegend】
当你在一个Linearlayout布局中只为一个组件设置android:layout_weight属性时,那么这个组件将默认填充Linearlayout的剩余空间(宽度与高度方向),而不用事先进行测量 ...
- Spark菜鸟学习营Day3 RDD编程进阶
Spark菜鸟学习营Day3 RDD编程进阶 RDD代码简化 对于昨天练习的代码,我们可以从几个方面来简化: 使用fluent风格写法,可以减少对于中间变量的定义. 使用lambda表示式来替换对象写 ...
- hdu 5769 Substring 后缀数组 + KMP
http://acm.hdu.edu.cn/showproblem.php?pid=5769 题意:在S串中找出X串出现的不同子串的数目? 其中1 <= |S| < $10^5$ 官方题解 ...
- MySQL 多实例数据库还原脚本-备份集与端口对应
版本:5.5.14 OS: ConetOS 6.3 1.创建recover.sh [root@yoon export]# vi recover.sh #!/bin/bash bakdir=/exp ...
- UserLogin
DAL: IUserDAL namespace Dal { /// <summary> /// This interface is defined for user functions. ...