template <typename Type,
typename Traits = DefaultSingletonTraits<Type>,
typename DifferentiatingType = Type>
class Singleton {
private:
// Classes using the Singleton<T> pattern should declare a GetInstance()
// method and call Singleton::get() from within that.
friend Type* Type::GetInstance();
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef BASE_LOG_H_ | |
#define BASE_LOG_H_ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <sys/time.h> | |
#ifdef DEBUG | |
#define CODE_INFO __FILE__, __PRETTY_FUNCTION__, __LINE__ |
- 这个和const一样,是对变量的限制 正如这个关键字的名字一样,这个关键字的意思就是,定义的变量是非常易变的。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C&C++——库头文件及其作用 | |
1、 一些头文件的作用: | |
:ANSI C。提供断言,assert(表达式) | |
:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含 | |
:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdir64()等 | |
:ANSI C。字符测试函数。isdigit(),islower()等 | |
:ANSI C。查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。来自linux 2.4.20-18的内核代码中的/usr/include/asm/errno.h | |
:处理命令行参数。getopt() |
侯捷 Effictive C++ 的中文版
c++ 难在于提供了四种不同的程序设计思维模式
- procedural-based
- object-based
- object-oriented
- generics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pthread是历史悠久的多线程模型。 |
[MEC] 条款2 最好使用c++转型造作符.md
###基础内容
- 指针
- 引用
- 类型转换
- 数组
- 构造函数