01 2019 档案

摘要:1.定义struct template 2.在类模板外定义各方法 阅读全文
posted @ 2019-01-18 07:06 super行者
摘要:stumble across 偶然遇到 it would be easier for me to do something 做XXX更方便 阅读全文
posted @ 2019-01-18 04:41 super行者 阅读(202) 评论(0) 推荐(0)
摘要:The Python Tutorial Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective 阅读全文
posted @ 2019-01-13 05:00 super行者
摘要:#include #include #include using namespace std; template class my_binder1st { public: my_binder1st(const Operation op, const Para first): m_op(op), m_first(first) { } Para operato... 阅读全文
posted @ 2019-01-06 09:16 super行者
摘要:函数对象,就是一个重载了"()"运算符的类的对象,它可以像一个函数一样使用。 STL中提供了一元和二元函数的两种函数对象:(都是模板) 一元函数对象: 二元函数对象: 下面是一段示例代码: 另一段示例代码: 阅读全文
posted @ 2019-01-05 20:27 super行者
摘要:运行后屏幕输出为:说明出现异常后auto_ptr指向的对象的析构函数仍然被执行了。 如果把上面代码中注释掉的代码打开,如下: 执行后屏幕显示如下:因为没有运用auto_ptr而用的裸指针,可以看到析构函数没有被调用 阅读全文
posted @ 2019-01-05 19:23 super行者
摘要:/* erase()删除指定元素,元素个数减1,即size-- remove()同时删除所有指定值的元素,其它元素前移补位,但元素总个数不变(size不变) */ #include #include #include using namespace std; template void print (vector &x) { typename vector::i... 阅读全文
posted @ 2019-01-04 22:33 super行者
摘要:#include #include #include using namespace std; /* demonstrate algorithm: find, for_each demonstrate reverse_iterator */ void print (int x) { cout d; for (int i=1; i::iterator p... 阅读全文
posted @ 2019-01-04 20:37 super行者
摘要:#include #include #include #include #include #include using namespace std; int main() { // demonstrate reverse an int array int a[4] = {3,2,4,1}; reverse(a,a+4); cout... 阅读全文
posted @ 2019-01-03 19:55 super行者
摘要:#include #include using namespace std; bool fncomp (char lhs, char rhs) {return lhs>rhs;} struct classcomp { bool operator() (const char& lhs, const char& rhs) const { return lhs> maps... 阅读全文
posted @ 2019-01-02 21:44 super行者
摘要:#include #include using namespace std; int main() { set st; st.insert("apple"); st.insert("orange"); st.insert("strawberry"); st.insert("peach"); st.insert("orange");... 阅读全文
posted @ 2019-01-02 21:03 super行者