在交叉编译一个.cpp库时,出现如下错误:undefined reference to `__gxx_personality_sj0'undefined reference to `operator new[](unsigned int)'解决办法:修改库中的Makefile文件,在$(LD) 后面...
分类:
其他好文 时间:
2015-03-04 12:40:33
阅读次数:
458
1.运算符重载定义:C++中预定义的运算符的操作对象只能是基本数据类型。但实际上,对于许多用户自定义类型(例如类),也需要类似的运算操作。这时就必须在C++中重新定义这些运算符,赋予已有运算符新的功能,使它能够用于特定类型执行特定的操作。运算符重载的实质是函数重载,它提供了C++的可扩展性,也是C+...
分类:
其他好文 时间:
2015-03-03 20:37:43
阅读次数:
107
试分析推断下述代码的输出结果:#include
#include
#include
using namespace std;
void* operator new(size_t size)
{
printf("my new -> %u\n", size);
return malloc(size);
}
void operator delete(void *p)
{
printf("...
分类:
其他好文 时间:
2015-03-02 11:14:53
阅读次数:
127
原文:http://blog.csdn.net/tanlijun37/article/details/1948493vector中对象指针的排序,初步想法是1: 把对象指针存到vector,重载bool operator(对象指针)2:用sort来排序例:class A{public: bool o...
分类:
编程语言 时间:
2015-03-01 16:51:51
阅读次数:
132
发现自己连向量的点乘都不会算了跨立实验#include #define MAXN 100struct point{ double x, y; point operator - (point temp) const { point res; res.x =...
分类:
其他好文 时间:
2015-03-01 06:48:41
阅读次数:
197
f(i)=min{f(j)+(D(j)using namespace std;#define N 1000001struct Point{int x,y;};bool operator =b.y;}int n,m,K,q[N];Point dp[N];int main(){ scanf("%d",&...
分类:
其他好文 时间:
2015-02-28 21:31:11
阅读次数:
166
#include#includeusing namespace std;struct S{ int a, b; string str; S operator+(const S &others) { S s1; s1.a = this->a + others.a; s1.b = this->a ...
分类:
编程语言 时间:
2015-02-28 14:28:34
阅读次数:
157
sublime设置:设置sublime回车跳转到()等外围:Preference-->用户热键设置-->[{"keys":["enter"],"command":"move","args":{"by":"characters","forward":true},"context":[{"key":"following_text","operator":"regex_contains","operand":"^[)\\]\\>\\‘\\\"]","ma..
分类:
其他好文 时间:
2015-02-28 00:27:01
阅读次数:
145
一、重载规则I.可以重载的操作符+-*/%^&|~!=>>>==*,->[]()operator newoperator new[]operator deleteoperator delete []II.不能重载的操作符::..*? :sizeoftypeidnewdeletestatic_cast...
分类:
编程语言 时间:
2015-02-26 14:34:23
阅读次数:
178
objc优点:1)Cateogies2)Posing3)动态识别4)指标计算5)弹性讯息传递6)Objective-C与C++可混合编程缺点:1)不支援命名空間2)不支持运算符重载3)不支持多重继承4)使用动态运行时类型,所有的方法都是函数调用,所以很多编译时优化方法都用不到。(如内联函数等),性能低劣。
分类:
其他好文 时间:
2015-02-26 11:50:36
阅读次数:
113