本文只讲述typeid这个操作符,呃 ,它确实是一个操作符,类似于 sizeof 操作符。
在将该操作符之前,不得不提的是
RTTI(Run-Time Type Identification,运行时类型识别),其实就是说在运行期得到对
象的实际的类型。这立刻使我们想到了
“可以通过基类的指针和引用可以指向实际的派生类型”。啊哦,答对了,这就是typeid
这个强大操作符所做的事...
分类:
编程语言 时间:
2014-05-07 05:58:26
阅读次数:
350
【题目】
Chapter 1 | Arrays and Strings
原文:
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
译文:
实现一个算法来判断一个字符串中的字符...
分类:
其他好文 时间:
2014-05-07 04:27:41
阅读次数:
312
【Question】
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the p...
分类:
其他好文 时间:
2014-05-07 04:17:18
阅读次数:
259
一,带函数Pred 1, all(Pred, List) ->
boolean()如果List中的每个元素作为Pred函数的参数执行,结果都返回true,那么all函数返回true,
否则返回false例子:lists:all(fun(E) -> true end,[1,2,3,4]).结果true...
分类:
其他好文 时间:
2014-05-07 01:59:17
阅读次数:
552
实现定时器有很多种方式,在这里我简单的介绍几种方式 (1)使用Handler +
Runnable的方式 Handler handler = new Handler();Runnable runnable = new Runnable() {
@Override public void run() ...
分类:
移动开发 时间:
2014-05-07 01:43:12
阅读次数:
521
http://blog.csdn.net/dotphoenix/article/details/84592771.
安装boost库sudo apt-get install libboost-all-dev或者使用源代码编译:sudo apt-get install
python2.6-devsud...
分类:
其他好文 时间:
2014-05-07 01:32:57
阅读次数:
366
Java提供了线程类Thread来创建多线程的程序。其实,创建线程与创建普通的类的对象的操作是一样的,而线程就是Thread类或其子类的实例对象。每个Thread对象描述了一个单独的线程。要产生一个线程,有两种方法:◆需要从Java.lang.Thread类派生一个新的线程类,重载它的run()方法...
分类:
编程语言 时间:
2014-05-07 01:22:53
阅读次数:
405
进程:运行在系统当中的任务(一个进程至少有一个线程)线程:运行在进程当中的任务(线程不能脱离进程)进程:独立内存地址空间
线程:同进程中线程共享内存地址继承Thread 类 run()子线程的入口子线程没结束前,主线程不会结束优先级(1-10 10最高)的设置,只能让优先级高的
抢到执行CPU的几....
分类:
编程语言 时间:
2014-05-07 00:02:20
阅读次数:
379
封装了一个基于C++11的线程池对象。
异步执行的任务,从线程池中分配一个空闲的线程来执行该任务.
如果没有空闲的线程可以执行,则进入队列排队
task_pool_init(10);
for( int i = 0 ; i < 200 ; i ++ )
{
run_job([i]{
std::this_thread::sleep_for(std::chrono::seconds(1));
});
}
...........................
...
分类:
编程语言 时间:
2014-05-06 23:16:37
阅读次数:
378
(defun buffer-exists (bufname)
(not (eq nil (get-buffer bufname))))
(defun make-shell (name)
"Create a shell buffer named NAME."
(interactive "sName: ")
(if (buffer-exists "*eshell*")...
分类:
其他好文 时间:
2014-05-06 19:40:04
阅读次数:
262