
C++笔记
文章平均质量分 63
jxtgddlt
这个作者很懒,什么都没留下…
展开
-
warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _
<br />使用VS2005以上版本(VS2005、VS2008、VS2010)编译在其他编译器下正常通过的C语言程序,你可能会遇到类似如下的警告提示:<br /> 引用内容<br />warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online原创 2011-05-28 14:36:00 · 16959 阅读 · 2 评论 -
类模板的友元
1,根据情况2,绑定模板友元函数。 templateclass CTest;template ostream & operator& rhs);templateclass CTest{public: CTest(const T& val): _item(val){} ~CTest(void){}原创 2011-06-06 11:30:00 · 611 阅读 · 0 评论 -
类成员函数声明为另外一个类的友元
class Class2;class Class1{ private: int m; public: void display( Class2 &cl2 ); Class1():m(1){} friend class Class2; void print(){cout<<"m="<<m<<endl;} };class Class2{ p原创 2011-05-28 18:33:00 · 1330 阅读 · 0 评论 -
二叉树 后序遍历 无tag域非递归实现
PS:看到网上N多都是有tag域的 这个暂时没发现什么bug 所以恳请哪位大神发现了帮忙指正一下!!3Q啦!!templatevoid BSTree::PostorderTraversal( ostream &os ){ BSTNode *p = NULL; stack *> st; st.push( _root ); while( !(st.empty()) ) { whi原创 2012-08-08 09:37:46 · 886 阅读 · 0 评论 -
C++ 单例模板类 (非线程安全 还没升到那个等级 以后再改)
#ifndef __Singleton_H__#define __Singleton_H__template class Singleton{public: static T* GetInstance(){ _s_garbo; /// 防止编译器优化掉 if( _pInstance == NULL ){ _pInstance = new T(); } asse原创 2013-02-10 20:22:03 · 1020 阅读 · 0 评论 -
类模板运用之实现委托类
// header.h#ifndef __main_H__#define __main_H__#include "StdAfx.h"templateclass C{public: typedef void (T1::*TemplateFun)(T2);public: C(T1 *t1, TemplateFun t2) :_t1(t1), _t2(t2){} void i原创 2013-02-18 20:45:07 · 587 阅读 · 0 评论