- 博客(13)
- 资源 (38)
- 收藏
- 关注
原创 chrome base 类库 manual 内存对齐
// Copyright (c) 2012 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.// AlignedMemory is a POD ty
2013-12-26 14:55:28 1008 1
原创 编译时给出警告的小trick,利用下标溢出的警告
template inline Dest bit_cast(const Source& source) { // Compile time assertion: sizeof(Dest) == sizeof(Source) // A compile error here means your Dest and Source have different sizes.
2013-12-24 15:37:53 641
转载 How Would You Get the Count of an Array in C++?
http://blogs.msdn.com/b/the1/archive/2004/05/07/128242.aspxThe question is simple: given a C++ array (e.g.x as inint x[10]), how would you get thenumber of elements in it?An obvious soluti
2013-12-24 14:28:22 680 2
转载 Memory Barrier in Compiler and CPU
http://www.cnblogs.com/whyandinside/archive/2012/06/24/2560099.htmlMemory Barrier in Compiler and CPUMemory barrier, is a type of barrier and a class of instruction which causes a CPU or com
2013-12-24 11:17:31 815
原创 chrome的base库中求最接近n的2的多少次幂,也就是k=log2(n); 求k的算法
// Copyright (c) 2009 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.// This file defines some bi
2013-12-24 10:57:22 1477 3
转载 AS3地图拼接与战争迷雾的实现
http://www.gameres.com/msg_201878.html在开发游戏的过程中,特别是地图编辑器中,需要利用最少的资源,实现最丰富的地形地貌。虽然现在众多的RPG开始使用整图,但是我们偶尔还是需要能够让玩家自己编辑地图,或者其他需要自动进行地图构建的功能。 另外,就是在一些策略类游戏里经常用到的战争迷雾,我试过自己编写Pixel Bender自己来编写过滤器而实现战争
2013-12-23 14:53:45 876 1
转载 c++学习之const成员变量与成员函数
http://www.cnblogs.com/huzhongzhong/archive/2011/10/09/2204861.html常类型是指用类型修饰符const说明的类型,常类型的变量或者对象的值是不能被更新的。因此,定义或说明常类型时必须初始化。如果在一个类声明常数据成员,那么任何函数中都不能对该成员赋值。构造函数对该成员进行初始化,只能通过初始化列表来实现。#include
2013-12-18 15:25:21 822
原创 虚函数的静态绑定和动态绑定
#include using namespace std;class A{public: A() { cout clear(); cout } virtual ~A() { } void clear() { memset( this, 0, sizeof( *this ) ); } virtual v
2013-12-18 15:04:49 1174 3
转载 vptr被设置内容的时机
http://eriol.iteye.com/blog/1167737 关于虚函数的背景知识用virtual关键字申明的函数叫做虚函数,虚函数肯定是类的成员函数。存在虚函数的类都有一个一维的虚函数表叫做虚表。类的对象有一个指向虚表开始的虚指针。虚表是和类对应的,虚表指针是和对象对应的。多态性是一个接口多种实现,是面向对象的核心。分为类的多态性和函数的多态性。多态用虚函数来实现,结合
2013-12-18 12:43:25 793 1
转载 c++对象内存模型【内存布局】
http://www.th7.cn/Program/cp/201301/122774.shtml #类中的元素0. 成员变量 1. 成员函数 2.静态成员变量 3. 静态成员函数 4.虚函数 5. 纯虚函数#影响对象大小的因素0. 成员变量 1. 虚函数表指针(_vftptr) 2.虚基类表指针(_vbtptr) 3. 内
2013-12-18 12:25:06 568
原创 给定能随机生成整数1到5的函数,写出能随机生成整数1到7的函数
6 \ 7 可以被拆分成 5 + 1 , 5 + 2, 首先生成 1-5的随机数,然后 + 随机2生成随机2的函数如下int rand2(){ for ( ; ; ){ int iRand = rand5(); if ( iRand == 3 ) { continue; } else
2013-12-17 16:03:09 1205
原创 泡泡龙算法模拟实现C++版
#include #include #include #include #include #include using namespace std; struct Bubble{ int iColor; Bubble() : iColor( 0 ) { } Bubble( int iSetColor ) : iColor( iSe
2013-12-16 18:50:02 3557
reliable rabbitmq c++ client
2018-07-16
trade middle ware
2018-06-29
simple exchange platform client
2018-06-01
evpp based echo server
2018-05-03
libevent echo server
2018-04-24
thrift with memfunc and uid generator
2018-01-30
thrift server support db operation and rest protocol
2018-01-18
20180111 ieap
2018-01-11
AnalyzeServer 20180109 with DBConnPool
2018-01-09
thrift example
2018-01-04
prpc_20181109
2018-11-09
coroutine using phxrpc
2018-11-01
remote procedure call using protobuffer
2018-08-21
brpc doubly_buffered_data test
2018-08-07
rabbitmq-c client publish get example
2018-07-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人