摘要: First, and only for the constructor of the most derived class as described below, virtual base classes shall be initialized in the order they appear on a depth-first left-to-right traversal of the directed acyclic graph of base classes, where “left-to-right” is the order of appearance of the base cl 阅读全文
posted @ 2012-01-12 17:56 百分百好牛 阅读(200) 评论(0) 推荐(0) 编辑
摘要: c++ 中的 mutable 关键字是什么意思?mutable is for the case where an object islogicallyconstant, but in practice needs to change.class Employee {public: Employee(const std::string & name) : _name(name), _access_count(0) { } void set_name(const std::string & name) { _name = name; } std... 阅读全文
posted @ 2012-01-12 17:03 百分百好牛 阅读(271) 评论(0) 推荐(0) 编辑
摘要: Given constant integers x and t, write a function that takes no argument and returns true if the function has been called x number of times in last t secs.Q: 题意很明确,实现一个函数,如果该函数在过去的t秒内,被call了x次,则返回trueA:1. 对一个queue包装一下,其size只有x2. 每次call 这个函数的时候,检查queue是否的size==x,如果满了,pop第一个,再添加。每次添加当时的时间到queue中3. 函数返 阅读全文
posted @ 2012-01-12 11:37 百分百好牛 阅读(353) 评论(0) 推荐(0) 编辑