vector<T>标准库模版类应该是绝大多数c++程序员使用频率比较高的一个类了.不过vector<bool>也许就不那么被程序员所了解.关于vector<bool>不尝试研究一番,一般还不太容易知道其中蕴含的问题. 首先得明确一点,那就是vector<bool>是vector<T>的特化版.这个特化版本要解决的问题就是存储容量的问题. To optimize space allocation, a specialization of vecto…
std::vector template < class T, class Alloc = allocator<T> > class vector; // generic template template <class Alloc> class vector<bool,Alloc>; // bool specialization(特殊化) Vector of bool This is a specialized version of vector, whi…
If you want to play Bink video in game, maybe you need this code. QBink.h #ifndef QBINK_H #define QBINK_H #include "bink.h" extern void PTR4* (RADEXPLINK *qBinkLogoAddress)(void); extern void (RADEXPLINK *qBinkSetError)(const char PTR4* err); ex…
(这是C++系列随笔的第二篇,这一系列是我练习C++而查的资料) C++ Primer 5th. Ed. pp. 425 ---------------------- Using a Comparison for the Key Type The type of the operation that a container uses to organize its elements is part of the type of that container. To specify our own…
The Unique MST 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/J Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E).…
K-wolf Number 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5787 Description Alice thinks an integer x is a K-wolf number, if every K adjacent digits in decimal representation of x is pairwised different. Given (L,R,K), please count how many K-wolf…
一般的我们喜欢这样对对象赋值: Person p1;Person p2=p1; classT object(another_object), or A a(b); classT object = another object; class A { // - }; int main( ) { A x; A y(x); // - A z = x; z = y; } 这样的话,如果成员变量中有指针的话,就容易造成指针的二次删除.这样就需要我们显示的在类中实现 1.拷贝构造, 2.赋值运算符重载…