Namespace, string, vector and array

时间:2023-02-20 13:11:09

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&comma;vector和array(C&plus;&plus; Primer读书笔记)

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

  2. C&plus;&plus; 标准库类型-String&comma;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 &lpar;25分&rpar; 使用map&lt&semi;string&comma; vector&lt&semi;int&gt&semi;&gt&semi;

    题目 Zhejiang University has 40000 students and provides 2500 courses. Now given the student name list ...

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

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

  6. Vector&comma; ArrayList&comma; Array

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

  7. perl malformed JSON string&comma; neither tag&comma; array&comma; object&comma; number&comma; string or atom&comma; at character offset

    [root@wx03 ~]# cat a17.pl use JSON qw/encode_json decode_json/ ; use Encode; my $data = [ { 'name' = ...

  8. gitlab-ci&period;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. 通过代码获取res里生成R&period;java中的值

    引用:http://my.eoe.cn/blue_rain/archive/552.html 有的时候我们生成库文件,需要在里面加入一些UI,并提供出一些xml的资源,那如何在其他项目中使用呢? 我们 ...

  2. WeCenter二次开发教程&lpar;一&rpar;:熟悉模板结构

    <1>程序文件目录介绍: app – 应用目录 models – 模型目录 plugins – 插件目录 static – 静态文件 system – 系统目录 views – 模板目录 ...

  3. &lbrack;windows操作系统&rsqb;目录和文件相关操作

    1.导出目录的树形结构到文本文件 tree /F d:\dir1 > d:\tree.txt 就是将d:\dir1的目录结构以树状形式输出报告到文件tree.txt中. 效果是这样的:

  4. 【转】Dancing Links题集

    转自:http://blog.csdn.net/shahdza/article/details/7986037 POJ3740 Easy Finding [精确覆盖基础题]HUST1017 Exact ...

  5. &lbrack;LeetCode&rsqb; 147&period; Insertion Sort List 解题思路

    Sort a linked list using insertion sort. 问题:实现单向链表的插入排序. 这是比较常规的一个算法题目. 从左往右扫列表,每次将指针的下一个元素插入前面已排好序的 ...

  6. 翻译器DIY它———算在英文文本中的单词数,字符和行数

    咳咳.这部分应该是序列化编译器DIY的,然而,在这样做DIY第一次使用前flex 为了练练手,对于后者的理解是有帮助. 在word 我经常看到一个字计数功能,因此,它是如何实现,当然,首先想到的是要经 ...

  7. &lbrack;转载&rsqb; java垃圾回收机制

    转载自http://blog.csdn.net/randyjiawenjie/article/details/7551228 http://www.daniel-journey.com/archive ...

  8. iOS 使用矢量图

    iOS 使用矢量图 iOS 图标通常用 PNG 格式的图片.PNG 图片放大到超过自身的大小就会模糊.可以使用 PDF 格式的矢量图,优点是任意改变图片大小并且保持清晰度. 简单使用 与 PNG 格式 ...

  9. css-tips

    div的height:100%有作用 其父元素设置height:100% 包括html,body

  10. WDA基础十五&colon;POPUP WINDOW

    1.组件控制器定义属性: 2.实现popup方法: METHOD stock_popup . DATA: l_cmp_api TYPE REF TO if_wd_component, l_window ...