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 ...
随机推荐
- SharedSDK微信分享不成功,分享之后没有反应
对于一般来说,使用SharedSDK的时候,分享不成功不外乎下面几个原因: 1.测试没有打包2.打包的keystore跟微信开放平台上面的不一致, 导致MD5码不一致3.分享参数错误4.应用没有审核通 ...
- 汇编语言-求X的阶乘
1. 题目:求X的阶乘值 2. 要求:输入一个整型数(不超过10),求出其阶乘值后输出,求阶乘的算法用子程序来实现. 3. 提示:可以用递归来实现,也可以用简单的循环来实现. 这里使用循环来实现: 对 ...
- Visual Studio 2013密钥
Visual Studio 2013旗舰版KEY:BWG7X-J98B3-W34RT-33B3R-JVYW9Ultimate:BWG7X-J98B3-W34RT-33B3R-JVYW9 Premium ...
- Winform合并多个Excel文件到一个文件中(源文件.xls,实际是.xml)
1.下面两个文件.xls是给的文件,实际上是.xml文件 2.具体的代码 private void btOK_Click(object sender, EventArgs e) { //0.获取路径文 ...
- PHP弱类型安全问题笔记
一.类型转换问题 intval(); var_dump(intval('1asdfasd')); //1 var_dump(intval('awqw12')); //0 var_dump(i ...
- 2013-07-24 IT 要闻速记快想
### ========================= ###凡客有闹钟?从凡客的角度来讲,闹钟等工具类应用是为推广品牌和产品服务,通过工具类产品给大众一个对凡客品牌的认知.而选择推出工具类的产品 ...
- MediaRecorder类介绍
audiocallbackvideojavadescriptorencoding 目录(?)[+] 找到个MediaRecorder类介绍和大家分享一下. Mediarecorder类在官网的介绍和在 ...
- 打包python脚本为exe可执行文件-pyinstaller和cx_freeze示例
本文介绍使用cx_freeze和pyinstaller打包python脚本为exe文件 cx_freeze的使用实例 需要使用到的文件wxapp.py, read_file.py, setup.py ...
- 深入剖析——float之个人见解
浮动的原本作用仅仅是为了实现文字的环绕效果. 以下分别是html与css代码,显示效果如下图.因为两个div使用了float浮动属性,所以脱离了标准文档流.让父元素撑开高度,我们需要清除浮动. < ...
- Microsoft server software support for Microsoft Azure virtual machines
http://support.microsoft.com/kb/2721672/en-us Article ID: 2721672 - Last Review: November 22, 2014 ...