码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
c++构造函数
在实例化类时,会自动调用构造函数构造函数可以重构当没有自定义构造函数时,系统会自动定义无参数的构造函数,但是一旦定义了一个构造函数,系统就不会自动定义无参数的构造函数#include using namespace std;class Box{public : Box(int,int,int); B...
分类:编程语言   时间:2014-06-19 08:35:13    阅读次数:232
模板中的名字查找问题
##**问题起源**先看下面很简单的一小段程序。```cpp`#include ```````cpptemplate struct Base { void fun() { std::cout struct Derived : Base{ void gun() { ...
分类:其他好文   时间:2014-06-19 06:11:12    阅读次数:244
poj 3254 Corn Fields
http://poj.org/problem?id=3254 1 #include 2 #include 3 #include 4 #define maxn 1000 5 using namespace std; 6 const int mod= 100000000; 7 8 int dp[...
分类:其他好文   时间:2014-06-18 23:48:54    阅读次数:374
HDU 2444 The Accomodation of Students 二分图判定+最大匹配
题目来源:HDU 2444 The Accomodation of Students 题意:n个人是否可以分成2组 每组的人不能相互认识 就是二分图判定 可以分成2组 每组选一个2个人认识可以去一个双人间 最多可以有几组 思路:二分图判定+最大匹配 #include #include #include using namespace std; const int maxn = ...
分类:其他好文   时间:2014-06-15 15:09:16    阅读次数:142
一步一步认识C++STL中的迭代器
既然“指针”的使用者一不小心就可能导致内存泄漏,那么我们如何能够使得指针的使用变得更安全呢?从C++面向对象的角度分析,我们有没有可能将“指针”封装起来,使得用户不直接接触指针,而使用一个封装后的对象来替代指针的操作呢?         答案是显然的,“智能指针”(smart pointer)正解决这类问题,尤其是在防止内存泄漏方面做得非常突出。C++标准库std中提供了一种“智能指针类”名为"...
分类:编程语言   时间:2014-06-15 15:04:11    阅读次数:352
cocos2d-x 3.0 rapidJson 操作应该注意的细节
Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstance()->getVisibleOrigin(); std::string path = FileUtils::getInstance()->fullPathForFilename("story.js...
分类:Windows程序   时间:2014-06-15 13:43:01    阅读次数:423
C++11 新特性之 tuple
我们在C++中都用过pair.pair是一种模板类型,其中包含两个数据值,两个数据的类型可以不同.pair可以使用make_pair构造 pair p = make_pair(1, "a1"); 如果传入的参数为多个,那么就需要嵌套pair,如下代码 #include #include using namespace std; int main() { // ,注意:在嵌套模板...
分类:编程语言   时间:2014-06-15 13:39:48    阅读次数:331
C++11 新特性之 序列for循环
在C++中在C++中for循环可以使用类似java的简化的for循环,可以用于遍历数组,容器,string以及由begin和end函数定义的序列(即有Iterator) #include #include #include using namespace std; int main() { map ms; ms.insert(make_pair("a", 1)); ms....
分类:编程语言   时间:2014-06-15 10:46:30    阅读次数:241
C++中关于指针运算符->的重载问题
#includeusing namespace std;struct date{int year;int month;int day;};struct Person{string name;int age;bool gender;double salary;date birth;Person(){c...
分类:编程语言   时间:2014-06-15 10:37:12    阅读次数:207
UVA 294 294 - Divisors (数论)
UVA 294 - Divisors 题目链接 题意:求一个区间内,因子最多的数字。 思路:由于区间保证最多1W个数字,因子可以遍历区间,然后利用事先筛出的素数求出质因子,之后因子个数为所有(质因子的个数+1)的积 代码: #include #include #include using namespace std; const int N = 35005; in...
分类:其他好文   时间:2014-06-15 10:17:36    阅读次数:158
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!