- 浏览: 722915 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (1043)
- 数据结构 (36)
- UML与设计模式 (42)
- c++ (87)
- rust (36)
- Qt (41)
- boost模板元编程 (43)
- Linux (77)
- 汇编 (4)
- 其它 (2)
- 烹饪 (3)
- unix c / socket (73)
- 软件工程 (4)
- shell (52)
- Python (37)
- c++ primer 5th(c++11) (22)
- 数据库/MySQL (27)
- 数据存储 (4)
- lisp (7)
- git (4)
- Utility (3)
- CDN与DNS (54)
- Http (53)
- php (7)
- nginx/lua/openresty (41)
- redis (11)
- TCP/IP (16)
- 互联网 (6)
- kernel (2)
- go (34)
- 区块链 (43)
- 比特股 (13)
- 以太坊 (23)
- 比特币 (23)
- 密码学 (10)
- EOS (53)
- DAG (1)
- docker (1)
- filecoin (7)
- solidity (64)
- ipfs (8)
- 零知识证明 (1)
- openzeppelin (3)
- java (1)
- defi (7)
最新评论
typeid可以获得一个对象的动态类型名称
type_info::before来sort
#include<iostream> #include<vector> #include<typeinfo> using namespace std; class Base{ public: virtual ~Base(){} }; class Derived:public Base{ public: ~Derived(){} }; int main() { vector<Base*> v; for(int i=0;i<100;i++){ v.push_back(new Base); v.push_back(new Derived); } for(vector<Base*>::const_iterator iter = v.begin(); iter != v.end(); ++iter) { if(Derived* d = dynamic_cast<Derived*>(*iter)){ cout << typeid(d).name() << endl; }else{ cout << typeid(*iter).name() << endl; } } } P4Base P7Derived P4Base P7Derived ...
#include<iostream> #include<typeinfo> #include<string> using namespace std; template<typename T> void print(const T& t) { cout << "typeid:" << typeid(t).name() << endl; } int main() { int a = 0; float b = 1; double c = 2; string d = "3"; print(a); print(b); print(c); print(d); } typeid:i typeid:f typeid:d typeid:Ss
type_info::before来sort
#include<stdlib.h> #include<vector> #include<iostream> #include<typeinfo> #include<map> using namespace std; class Shape{ public: virtual void draw() = 0; virtual ~Shape(){}; virtual int edge(){return 3;} }; class Circle:public Shape{ public: void draw(){cout << "Circle::draw()"<<endl; } int edge(){return 3;} ~Circle(){cout << "~Circle()" << endl; } }; class Rectangle : public Shape{ public: void draw(){ cout << "Rectangle::draw()" << endl;} int edge(){return 4;} ~Rectangle(){cout << "~Rectangle()" << endl;} }; class Square : public Shape{ public: void draw(){ cout << "Square::draw()" << endl;} int edge(){return 4;} ~Square(){ cout << "~Square()" << endl;} }; void drawQuad(Shape& shape){ if(shape.edge()<4){ cout << "not a polygone" << endl; }else{ cout << "a polygone" << endl; } } struct TInfoLess{ bool operator()(const type_info* t1,const type_info* t2)const{ return t1->before(*t2); } }; typedef map<const type_info*,vector<Shape*>,TInfoLess> shapeMap; int main(){ srand(time(0));//seed a random vector<Shape*> v; shapeMap smap; int num = 0; Shape *shape; for(int i=0;i<10;++i){ num = rand(); switch(num%3){ case 0: shape = new Circle; break; case 1: shape = new Rectangle; break; case 2: shape = new Square; break; } smap[&typeid(*shape)].push_back(shape); } for(shapeMap::iterator iter = smap.begin();iter!=smap.end();++iter){ //print } }
发表评论
-
柔性数组
2017-09-20 09:53 448#include <iostream> #i ... -
rawsocket发送icmp包
2017-09-06 09:54 620#include <stdio.h> #in ... -
查看glibc版本
2016-12-07 14:13 500strings /lib64/libc.so.6 |grep ... -
trim
2015-05-14 14:45 323/* trim from start */ ... -
log
2015-03-30 17:42 414log.h #ifndef __LOG_H__ #def ... -
输出类名
2014-02-20 21:51 544#include <iostream> us ... -
GC的改良
2013-10-17 22:05 530分代回收:对分配不久,诞生时间较短的“年龄”对象进行重点扫描, ... -
GC与引用记数
2013-10-16 21:57 666根(Root)就是判断对象是否可被引用的起始点。至于哪里才是根 ... -
pthread
2013-07-09 10:10 554#include <pthread.h> # ... -
const
2012-10-08 23:57 1117#include<iostream> usi ... -
声明与定义
2012-10-04 11:33 661extern int i;//声明但未定义 int j;//声 ... -
windows下iconv转码
2012-08-28 17:07 2816http://ah-fu.iteye.com/blog/281 ... -
在windows下使用pthread
2012-08-28 10:12 759http://hi.baidu.com/yylwuwei/bl ... -
消除编译器未使用的警告
2012-03-29 15:07 1065#define XXX_UNUSED(x) (void)x; ... -
消息队列
2012-03-27 16:56 1372msgget函数用于创建一个新的消息队列或访问一个已存在的消息 ... -
静态链接库
2012-03-16 16:54 664静态库是obj文件的一个集合,通常以.a为后缀,理论上执行速度 ... -
#if0
2012-03-07 13:45 1216#if 0 #endif 用于屏蔽注释中间的代码,避免注释嵌 ... -
枚举转char
2012-03-05 11:54 954#define NAME(value) #value -
libevent相关
2012-02-03 11:04 1646void event_set(struct event *ev ... -
c++0x
2012-02-01 09:55 735http://blog.csdn.net/pongba/art ...
相关推荐
C语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC语言头文件 TYPEINFO.HC...
在java编程思想一书中经常需要用到的jar包,typeinfo.pets
软件介绍: typeinfo-pets.jar是Java编程思想第四版中用源码生成的jar文件所需使用的jar包,解压后自行添加到Bulid path路径里即可使用。
think java中需要用到的包
C语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 TYPEINFOC语言头文件 ...
pointer to a dst_type which has (static_ptr, static_type) above it const void dst_ptr_leading_to_static_ptr .
类型识别:typeinfo 智能指针:memory 输入输出流操作:iomanip、sstream 字符处理:cctype、cwctype 局部化:locale 这只是一小部分C++标准库头文件,实际上C++标准库还有更多的头文件,涵盖了各种不同的功能和特性...
只使用了STL的vector和typeinfo库.性能与boost的function相同,性能与boost::function库相同。 利用[](...)调用单个函数委托性能稍好一些。 二、声明形式: 目前支持0到9个参数 QLib::Event ev0; //零...
<typeinfo> 支持变量在运行期间的类型标识 <exception> 支持异常处理,这是处理程序中可能发生的错误的一种方式 <cstdarg> 支持接受数量可变的参数的函数。即在调用函数时,可以给函数传送数量不等的数据项。它...
InvRegistry.RegisterInvokeOptions(TypeInfo(WeatherWebServiceSoap), ioDocument); 把这句加上2005前的版本不加这个就出错,我也是找了很久才发现的 而且要加到initialization 最后一行,我加到initialization ...
打开企业管理器->数据库->WebMedia->表->TypeInfo->打开表->返回所有行->建立好您电影分类名称 打开企业管理器->数据库->WebMedia->视图->v_Proginfo->设置视图,找到wherefrom、dtPhoto、 ProgNotes 前面勾上保存...
RecordLoadJSON(gloss, @json[1], TypeInfo(TGlossary)); Memo1.Clear; Memo1.Lines.Add(gloss.glossary.title); // 中国 Memo1.Lines.Add(gloss.glossary.GlossDiv.title); // 湖南省 Memo1.Lines.Add(gloss....
think in java这本书上的源代码,免除了新手你敲代码麻烦,方便你的使用和学习
'OLE typeinfo data in the system registry. After running it once, close the server 'manually and everything should be set for your client app to call the server through 'OLE. 'Note6: Every time you ...
介绍说明 C标准库源代码,能提高对C的理解,不错的哦 下载文件列表 Pack : clibsource.rar C 标准库源代码\ABORT.C C标准库源代码\ABS.C C标准库源代码\ACCESS.C C标准库源代码\ADJUSTFD.C C标准库源代码\ALGRITHM ...
#include <typeinfo.h> #include"·.\14\tstash.h" class shape { protected: S 七atic in七coun店 public: shape() { count++; vir七ual -shape() = O { count--; } vir七ual void draw () const = O; static in七...
SetEnumType(TypeInfo('TMyDelphiEnumType')); - ADD: Added the functions PathLength and PathLengthPos in the module FlexPath. Also added the parameter LengthPos in the function PointOnLine (see the ...
TypeInfo公开有关本机Swift结构,协议,类,元组和枚举的元数据。 它捕获属性,通用类型,继承级别等。 例 假设您有一个用户结构: struct User { let id : Int let username : String let email : String } 要...
将 ctags-Universal JSON 输出传递到该程序中,以从 C++ 头文件中解析出类/结构(例如 cmd>python classesstripper.py typeinfo.json)重要说明:告诉 ctags 不要排序以保持成员变量的顺序正确示例 cmd 行:ctags -...