码迷,mamicode.com
首页 >  
搜索关键字:operator-    ( 3564个结果
c++中placement new
c++中的placement new是::operator new的重载版本,用于在已经分配好的内存上创建对象。这样就可以在用户空间对内存进行操作,减少了对象生成的成本,控制对象的地址从而减少内存碎片,对象池估计也是这么搞的吧。class A{public: A(){ cout<...
分类:编程语言   时间:2015-01-27 00:18:04    阅读次数:261
loki仿函数原理
loki仿函数原理 问题一:已知函数Fun有2个参数,请完成CTestFunctor类,使得CTestFunctor的()实际调用Fun,部分代码如下: #include using namespace std ; class CTestCommand { public:  void operator()(int x,double y)  {   cout  } }; ...
分类:其他好文   时间:2015-01-26 13:46:02    阅读次数:186
[leetcode] 29 Divide Two Integers
问题描述: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 基本的用减法操作可以实现除法,但是速度较慢。为了加快速度,每次将除数和结果加倍。 代码: int divide(int dividend,...
分类:其他好文   时间:2015-01-26 13:45:55    阅读次数:103
poj1094 拓扑排序
http://poj.org/problem?id=1094 Description An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to larges...
分类:编程语言   时间:2015-01-25 19:39:31    阅读次数:185
[LeetCode]29.Divide Two Integers
【题目】 Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 【分析】 不能用乘除和取模,就只能用加减和位运算。 最简单的方法就是不断的减去被除数。这种方法的迭代次数是结果的大小,即比如结果为n,算法复杂度...
分类:其他好文   时间:2015-01-25 11:09:58    阅读次数:106
Python学习日记[1]
Day1:输入输出语句:input、print控制语句:if、else、elif…循环语句:for(类似于C#里面的foreach),while…type(), isinstance()…data type:int, float, bool, str…`operator:**, //,…列表:一个打...
分类:编程语言   时间:2015-01-25 11:06:54    阅读次数:219
c++为什么定义了析构函数的类的operator new[]传入的参数会多4字节?
问题:在网上看人写了这么一段代码: 1 class A 2 { 3 public: 4 A() 5 { 6 std::cout #include "A.h" 29 30 void* operator new[](size_t size) ...
分类:编程语言   时间:2015-01-25 08:42:29    阅读次数:302
C++ new new[]详解
精髓:operator new()完成的操作一般只是分配内存;而构造函数的调用(如果需要)是在new运算符中完成的。operator new和new 运算符是不同的,operator new只分配内存,而只要new出现无论是不是operator new都会调用new运算符从而调用析构函数。例子是:#...
分类:编程语言   时间:2015-01-25 08:41:29    阅读次数:302
“CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明)
c++工程编译报错:“CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明)错误无法直接定位源码位置,网上搜索了,也和我的代码不一样。最后还是自己认真检查代码,发现了个问题头文件定义了一个CEvent x,源码文件中使用了 x = new CEve...
分类:其他好文   时间:2015-01-25 01:21:54    阅读次数:389
RAD C++Builder xe7 std::map xtree BUG
c++Builder 6 下的std::map还能用,有代码提示。换到xe7,代码提示出来就一个tt.operator [](),代码没法往下写了。最后把Target Platforms切换到64 bit windows 竟然可以了!!!
分类:编程语言   时间:2015-01-22 21:34:47    阅读次数:289
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!