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的更多相关文章

  1. string,vector和array(C++ Primer读书笔记)

    string string是标准库类型,使用时需要包涵头文件,使用using声明. include <string> using std::string; 1.定义和初始化 string ...

  2. C++ 标准库类型-String,Vector and Bitset

    <C++ Primer 4th>读书摘要 最重要的标准库类型是 string 和 vector,它们分别定义了大小可变的字符串和集合.这些标准库类型是语言组成部分中更基本的那些数据类型(如 ...

  3. vector以及array和数组

    //比较数组.vector.array #include <iostream> #include <vector> #include <array> #includ ...

  4. 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 ...

  5. Swift3 - String 字符串、Array 数组、Dictionary 字典的使用

    Swift相关知识,本随笔为 字符串.数组.字典的简单使用,有理解.使用错误的地方望能指正. ///************************************************** ...

  6. Vector, ArrayList, Array

    JAVA新手在使用JAVA的时候大概都会遇到这个问题: JAVA中的Array, ArrayList, Vector, List, LinkedList有什么样的区别?尤其是Vector, Array ...

  7. 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' = ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. javaScript 连续子数列最大和

    <!DOCTYPE html> <html> <head> <title></title> <meta charset=utf-8&g ...

  2. 《DNS的正向反向解析》RHEL6

    DNS的正向解析: Iptables –F Setenforce 0 安装DNS服务器的软件包: 启动DNS服务器: 修改DNS的配置文件:vim /etc/named.conf 修改DNS的配置:( ...

  3. FIR滤波器(1)- 基础知识

    FIR滤波器广泛应用于数字信号处理中,主要功能就是将不感兴趣的信号滤除,留下有用信号.FIR滤波器是全零点结构,系统永远稳定:并且具有线性相位的特征,在有效频率范围内所有信号相位上不失真.在无线通信收 ...

  4. 在 linux x86-32 模式下分析内存映射流程

    前言 虚拟内存机制已经成为了现代操作系统所不可缺少的一部分, 不仅可以为每个程序提供独立的地址空间保证安全性,更可以通过和磁盘的内存交换来提高内存的使用效率.虚拟内存管理作为linux 上的重要组成部 ...

  5. CentOS6.5升级手动安装gcc4.8.2

    一.简易安装 操作环境 CentOS6.5 64bit,原版本4.4.7,不能支持C++11的特性~,希望升级到4.8.2 不能通过yum的方法升级,需要自己手动下载安装包并编译 1.1 获取安装包并 ...

  6. CentOS 7 用户账户配置

    说明: 1.这篇博文记录的是CentOS 7 用户账户的配置,包括添加用户.添加用户组.删除用户.删除用户组等.其中包括分析用户的配置文件.目录以及对安全的思考. 2.用户配置方面CentOS 7与以 ...

  7. Andriod docs加载速度慢的问题解决

    网上找了个类, import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import ja ...

  8. UDP HelloWord

    Client.cpp #include <stdio.h> #include <winsock2.h> #pragma comment (lib,"ws2_32&qu ...

  9. android 线程

    android线程: 通用多个线程通信管理框架: 1.Handler监听者框架:子线程是事件源,主线程是监听者.        Handler作为子线程的监听器出现:主线程中生成Handler的子类, ...

  10. Golang学习笔记

    一.基础 1. Hello World程序 demo: package main import "fmt" // 注释 //注释 func main() { fmt.Printf( ...