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. VBA访问SQLSERVER2005筛选数据库

    EXCEL版本2010, 引用 Private Sub CommandButton1_Click() Dim conn As New ADODB.Connection Dim rs As New AD ...

  2. 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏

    function orient() {if (window.orientation == 90 || window.orientation == -90) {//ipad.iphone竖屏:Andri ...

  3. 扩展 delphi 线程 使之传递参数.

    新delphi的线程TThread有了CreateAnonymousThread方法,如果再为它加一个可传递的参数不就更好了吗?代码如下: TAnonymousThreadX<T> = c ...

  4. python杂记-6(time&datetime模块)

    #!/usr/bin/env python# -*- coding: utf-8 -*-import timeprint(time.clock())##返回处理器时间,3.3开始已废弃 , 改成了ti ...

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

  6. 【转载】Powershell设置世纪互联Office365嵌套组发送权限

    Start-Transcript ".\Set-GroupSendPermisionLog.txt" -Force function Get-DLMemberRecurse { $ ...

  7. 转学步园:jquery offset

    JQuery Offset实验与应用 我们有时候需要实现这样一种功能:点击一个按钮,然后在按钮的下方显示一个div.当按钮位于角落时,div的位置设定就需要计算,使div完全显示. 我打算使用offs ...

  8. MySQL监控工具-orztop

    先安装orzdba,链接:http://blog.itpub.net/28939273/viewspace-1875895/ 安装依赖的包:[root@hank-yoon servers]# yum ...

  9. MySQL 从库日志比主库多

    在群里聊天的时候,一个群友说,生产库主库宕机,但是主从数据库数据一致,但是从库的日志比主库多,很是不理解! 咨询后发现,生产库的主库没有设置sync_binlog=1,而是为sync_binlog=0 ...

  10. mapreduce 实现pagerank

    输入格式: A 1 B,C,D B 1 C,Dmap: B A 1/3 C A 1/3 D A 1/3 A |B,C,D C B 1/2 D B 1/2 B |C,Dreduce: B (1-0.85 ...