Basic

C++ str to int 
stoi
http://www.cplusplus.com/reference/string/stoi/

int to str
to_string

c++ vector 
erase 返回的是下一个
Insert(iter, val) iter是将要被insert的位置

位运算注意优先级
((d & 0xFF) == 0xFF)

注意检查退出循环时:比如merge sorted array退出循环,或者检查UTF的时候,退出循环但还需要后面的值(393)

upper_bound/lower_bound
[lower, upper) 左闭右开,如果不存在,指向的都是需要插入的位置


map的使用
Find/insert/erase/clear

sort的使用
倒序:sort(v.begin(),v.end(),greater<int>());

class cmp {
    public:
    bool operator()(const int &a, const int &b) {
        return a<b;
    }
};

bool表示a是不是应该在b前面


string 

str.find(“awd”) / rfind
Find(“awd”m,pos)
String::npos

pos从这个包括这个位置的之后开始搜索

Find_first_of
find_last_of
找一个字符

str.Insert(pos,str)

Substr(pos, len)
// Parse a string to vector
std::string myString = "10 15 20 23";
std::stringstream iss( myString );
int number;
std::vector<int> myNumbers;
while (!iss.eof()) {
iss>>number;
myNumbers.push_back( number );
}

Queue
pop
push
front
Back