码迷,mamicode.com
首页 >  
搜索关键字:typedef struct    ( 24378个结果
c++ map自定义比价函数
在C++中用到map时,如果KEY是自定义的struct,那么需要自己定义比较函数。因为只有基本类型有默认的比较方法。定义的方法有两种,一是在作为key的struct中,重载操作符less( UrlMap; UrlKey stKey; stKey.dwBussID = 1; stKey.dwV...
分类:编程语言   时间:2014-05-10 06:10:26    阅读次数:332
【LeetCode】Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi...
分类:其他好文   时间:2014-05-10 00:32:56    阅读次数:326
boost::function实践——来自《Beyond the C++ Standard Library ( An Introduction to Boost )》
代码段1: 1 #include 2 #include 3 4 5 float mul_ints(int x, int y) { return ((float)x) * y; } 6 struct int_div { 7 float operator()(int x, int y)...
分类:编程语言   时间:2014-05-09 23:38:56    阅读次数:487
C语言实现状态设计模式
#include #include #include #ifndef VIRTUAL #define VIRTUAL #endif #ifndef DELETE #define DELETE(X) do { free(X);X = NULL; } while(0) #endif #define NEW(TYPE,pInstance,SUBTYPE) struct TYPE* pInst...
分类:编程语言   时间:2014-05-09 22:29:48    阅读次数:455
【HDOJ】2612 Find a way
BFS。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define INF 0x3fffffff 8 9 typedef struct node_st {10 int x, y, ...
分类:其他好文   时间:2014-05-09 20:18:48    阅读次数:339
sizeof和strlen的区别
一、sizeof sizeof(...)是运算符,在头文件中typedef为unsigned int,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。 它的功能是:获得保证能容纳实现所建立的最大对象的字节大小。 由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小...
分类:其他好文   时间:2014-05-09 16:11:21    阅读次数:267
[python网络编程]DNS服务器
在上一篇中,使用scrapy修改源IP发送请求的最后我们提到由于hosts文件不支持正则,会导致我们的随机域名DNS查询失败。是用DNS服务器可以解决这个问题,下面是我用gevent写的小工具,很简单。我们只拦截匹配的A记录,然后发送DNS Response,如果不匹配,那么我们服务器就是一个DNS代理,转发请求。# -*- coding=utf-8 -*- import struct from...
分类:编程语言   时间:2014-05-09 13:49:34    阅读次数:560
论枚举类型的存储空间
一、概述1、定义类型typedef enum{ Monday, Tuesday} DAY;2、使用DAY day = Monday;3、疑问 在定义和使用枚举类型的时候,我们并不知道枚举变量的存储空间是多大?现在开始做测试。二、Visual C++ 6.0下测试#include typ...
分类:其他好文   时间:2014-05-09 10:08:35    阅读次数:305
vs05字节对齐问题又一不小心就弄去了我一个下午的时间
由于一字节的对齐问题,我调一个库调了我基本一个下午.....犯错其实并不可怕,可怕的是你一犯再犯......这也算得上是难能可贵.../Zp (Struct Member Alignment)Visual Studio 2013Other VersionsThis topic has not yet...
分类:其他好文   时间:2014-05-09 09:40:28    阅读次数:306
循环顺序队列
#include using namespace std; const int MAXQSIZE = 5; //队列类 template struct LinkList { T * data;//指向连续的数据存储区域 int front;//头指针 指向第一个元素 int rear;//尾指针 如果队列不为空指向最后元素的下一个位置 }; //构造一个空队列 template void...
分类:其他好文   时间:2014-05-09 06:07:53    阅读次数:248
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!