BOOST_FOREACH可以方便的遍历STL容器.
只需要头文件:
#include
然后遍历容器vector/list/set/deque/stack/queue都是类似的:
vectorint32_t> _v;
BOOST_FOREACH(int32_t value,_v)
{
//这里就可以访问value
}
同时元素还支持引用,const,比如...
分类:
其他好文 时间:
2014-11-04 11:03:46
阅读次数:
154
/** * 读取输入流数据 * @param inStream * @return */ public static byte[] read(InputStream inStream) throws Exception{ ByteArray...
分类:
移动开发 时间:
2014-11-04 10:38:03
阅读次数:
191
#include #include #include using namespace std;bool push_validate(int &pre_push, int max_push, int cur, vector& stack, int mcap) { if (pre_push >= ...
分类:
其他好文 时间:
2014-11-04 01:28:04
阅读次数:
248
题目来源:A Broken Calculator题目如下(链接有可能无法访问):A Broken CalculatorTime limit: 2sec /Stack limit: 256MB /Memory limit: 256MBProblemDave's calculator is broken...
分类:
其他好文 时间:
2014-11-04 01:25:28
阅读次数:
251
Java中的异常与错误都继承自Throwable,Exception又分为运行时异常(RuntimeException)和编译时异常。 运行时异常是程序的逻辑不够严谨或者特定条件下程序出现了错误,例如做除法运算时除数为0,运行时异常Java是不要求一定去try,catch进行捕获的。我们调试代...
分类:
编程语言 时间:
2014-11-04 00:09:24
阅读次数:
223
public abstract class Stack { public abstract boolean isEmpty(); public abstract boolean isFull(); public abstract T top(); public abstrac...
分类:
编程语言 时间:
2014-11-03 19:12:43
阅读次数:
207
顺序栈,即栈的顺序存储结构是利用一组地址连续的存储单元依次存放自栈底到栈顶的数据元素,同时附设指针top指示栈项元素在顺序栈中的位置。
#include "stdio.h"//包含头文件,就是编译时候把stdio.h中的内容替换到这个位置。
struct stack//定义结构体stack
{
int length;//定义整型变量length
struct data *top;//...
分类:
其他好文 时间:
2014-11-02 22:34:32
阅读次数:
220
最简单的方式 var t = new Task(() => { throw new Exception("unknow excption"); }); t.Start(); try ...
分类:
其他好文 时间:
2014-11-02 22:15:24
阅读次数:
169
C - A Great Alchemist
Time limit : 2sec / Stack limit : 256MB / Memory limit : 256MB
Problem
Carol is a great alchemist.
In her world, each metal has a name of 2N (N
is an integer) l...
分类:
其他好文 时间:
2014-11-02 16:34:23
阅读次数:
206
Time limit : 2sec / Stack limit : 256MB / Memory limit : 256MB
Problem
Charlie was born January 1st of the year A,
on the Earth. He will leave the Earth on December 31st of the year B.
He w...
分类:
其他好文 时间:
2014-11-02 16:32:02
阅读次数:
258