随笔分类 -  C++

摘要:int main(int argv, char* argc[]), argc[0] is always the program's name that you run switch() statement doesn't accept std::string. One way to solve th 阅读全文
posted @ 2016-02-02 05:15 Rui Yan 阅读(148) 评论(0) 推荐(0)
摘要:1. Template functiontemplate // a template prefixT func(T a, T b, T c){ // return value is T type, 3 T-typed formal parameters return a + b + c;}We... 阅读全文
posted @ 2014-11-24 05:32 Rui Yan 阅读(156) 评论(0) 推荐(0)
摘要:refer to this article 1 bool IsPrimeOptimizationThree(int number) 2 { 3 if(number<2) 4 return false; 5 if(number==2) 6 return ... 阅读全文
posted @ 2014-11-21 10:09 Rui Yan 阅读(243) 评论(0) 推荐(0)
摘要:So you have a C++ template class, but you want to specifiy a member function for a particular type of data: 1 // A template class called Image: 2 tem... 阅读全文
posted @ 2014-11-16 01:06 Rui Yan 阅读(183) 评论(0) 推荐(0)
摘要:BFS is faster to find shortest path from root to leaf node of a tree. But the tradeoff is to use more memory.the basic trategy is to maintain a list t... 阅读全文
posted @ 2014-11-11 03:43 Rui Yan 阅读(179) 评论(0) 推荐(0)