- 博客(14)
- 资源 (1)
- 收藏
- 关注
转载 std::auto_ptr的使用方法
项目管理之商务 gettid和pthread_self的用法正确使用std::auto_ptr 2012-05-21 14:47:41| 分类:C/C++ | 标签:|举报|字号大中小 订阅 用微信 “扫一扫”将文章分享到朋友圈。
2015-05-12 13:20:40
433
原创 boost:unordered_map和std::map的使用详解和性能比较
今天看到 boost::unordered_map, 它与 stl::map的区别就是,stl::map是按照operator<比较判断元素是否相同,以及比较元素的大小,然后选择合适的位置插入到树中。所以,如果对map进行遍历(中序遍历)的话,输出的结果是有序的。顺序就是按照operator< 定义的大小排序。而boost::unordered_map是计算元素的Hash值,根据H
2015-05-12 11:29:08
4909
转载 map和hash_map的比较
在网上看到有关STL中hash_map的文章,以及一些其他关于STL map和hash_map的资料,总结笔记如下: 1、STL的map底层是用红黑树实现的,查找时间复杂度是log(n); 2、STL的hash_map底层是用hash表存储的,查询时间复杂度是O(1); 3、什么时候用map,什么时候用hash_map? 这个药看具体的应用,不一定常数级
2015-01-13 16:54:29
508
转载 std::unary_function
C++98Unary function object base classNote: This class has been deprecated in C++11. This is a base class for standard unary function objects.Generically, function objects are instances o
2015-01-09 15:58:59
789
原创 Passing pointers to functions
Don’t!▪Ownership is ambiguous▪It implies the argument can be nullPrefer a reference if the function is only observing the argumentUse a unique_ptr or auto_ptr if you pass ownership to the fu
2015-01-09 09:57:02
649
原创 Use standard algorithms
Use standard algorithmsLearn them if you don’t know themLearn to recognize them▪Standard algorithms will decrease CO2 emissions by a factor of 42 std::string lowerPath = path; std::transform(l
2015-01-09 09:48:39
383
原创 Ownership
Pointers don’t model ownership at all. The ownership has to be specified with comments to avoid misuse▪Dangling pointers, double delete and leaks are symptoms of (mis)using pointers to model ownersh
2015-01-09 09:47:33
448
原创 Buffers ▪Avoid allocating buffers with new/malloc. Buffers are perfectly modeled with std::vector ▪P
Buffers▪Avoid allocating buffers with new/malloc. Buffers are perfectly modeled with std::vector▪Prefer the stack for temp buffers, if the size is char* temparray = (char*)malloc(10); mems
2015-01-09 09:45:04
432
原创 sqlite3采用MD5和Aes联合加密技术
#include "aes/aes.h"#include "md5/md5.h"#include "src/sqlite3.c"#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"typedef unsigned char byte_t;struct CryptBlo
2015-01-07 14:39:37
1703
原创 FPS优化
FPS即Frame Per Second,是游戏对用户体验非常重要的一项技术指标。目录1 CPU/GPU2 针对CPU进行优化2.1 瓶颈2.2 常见的优化2.3 Loading效率优化3 GPU优化3.1 辨别顶点着色器和像素着色器瓶颈3.2 常见顶点着色器性能问题3.3 常见像素着色器性能问题CPU/GPU游戏软件的结构一
2015-01-07 14:33:08
1543
原创 IOS分辨率的修改方法
1. open terminal 2. type: cd /Library/Preferences/SystemConfiguration press ENTER3. type: sudo nano com.apple.boot.plist. An xml file should open in a word editor named nano. 4. Find the line where
2015-01-07 11:39:36
2815
原创 Ogre内存分配器分析(1)
#ifndef __AllocatedObject_H__#define __AllocatedObject_H__#include "OgrePrerequisites.h" //平台定义,包含所有调试模式,引擎版本,VC++版本,常用基本类型重定义,多线程使用声明,引擎内主要类声明,Ogre内所用到的std头文件包含进来
2013-08-14 17:13:16
938
原创 C++内存分配操作符new(new operator),operator new,placement new详解
由于这几个操作符,特别是placement new 经常使我不知道怎么用,现在我就把它的用法记录下来.1.new(也称作new operator)在C++里经常这么使用:class MyClass{};MyClass*p = new MyClass();这里的new在C++里是默认的关键字,它本质是一个操作符(就像+,-,*,/)调用new操作符实际上执行以下三个步骤:
2013-08-14 16:34:49
658
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人