随笔分类 -  C++

stl之std::remove_copy
摘要:template OutputIterator remove_copy (InputIterator first, InputIterator last, OutputIterator result, const T& val);说明: ... 阅读全文

posted @ 2015-01-05 23:58 FlowingCloud 阅读(333) 评论(0) 推荐(0)

the “inner class” idiom
摘要:有些时候我们需要upcast为多种类型,这种情况下除了可以使用multiply inherits还可以inner class。 以下为例子://: C10:InnerClassIdiom.cpp// Example of the "inner class" idiom.#include #inclu... 阅读全文

posted @ 2014-04-21 23:13 FlowingCloud 阅读(216) 评论(0) 推荐(0)

State 状态模式
摘要:常见设计模式之状态模式青蛙王子的故事,青蛙王子在公主亲吻前后表现是不一样的,这里以打招呼为例。//: C10:KissingPrincess.cpp#include using namespace std;class Creature { bool isFrog;public: Creature... 阅读全文

posted @ 2014-04-16 22:46 FlowingCloud 阅读(207) 评论(0) 推荐(0)

Singleton 单例模式
摘要:常见设计模式之单例模式//: C10:CuriousSingleton.cpp// Separates a class from its Singleton-ness (almost).#include using namespace std;template class Singleton { ... 阅读全文

posted @ 2014-04-15 22:22 FlowingCloud 阅读(197) 评论(0) 推荐(0)

导航