自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

噬日者

Eclipser : 吞噬sun ...

  • 博客(15)
  • 资源 (1)
  • 收藏
  • 关注

原创 C++ 流的粗略运用

/* * File: main.cpp * Author: Vicky.H * Email: eclipser@163.com */#include #include #include #include class A {public: friend std::ostream& operator<<(std::ostream& os,

2012-09-29 11:51:48 6300

原创 C++为什么不建议使用malloc,calloc,realloc来分配内存?

为什么C++中不建议使用malloc calloc realloc等C语言函数?因为:这样分配的空间,返回的指针需要通过free来释放,但free释放空间不同于delete,free不会执行析构函数! /* * File: main.cpp * Author: Vicky.H * Email: eclipser@163.com */#include #inc

2012-09-27 13:14:54 7026

原创 new (nothrow) T() 的原理

查看中对new的声明.void* operator new(std::size_t) throw (std::bad_alloc);void* operator new(std::size_t, const std::nothrow_t&) throw();void* operator new[](std::size_t) throw (std::bad_alloc);void*

2012-09-27 12:50:12 5087

转载 内存管理元素

1、三个最重要算法:uninitialized_copy、uninitialized_fill、uninitialized_fill_n 会构造新的对象object,而copy、fill、fill_n会赋新值于已存在的对象上。 2、construct 构造器:template void construct(T1* p,const T2& value);construct(p,v

2012-09-27 11:34:02 675

原创 未初始化的存储uninitialized_x

除了,allocator空间分配器之外,中还有初始化容器标准库函数.分别为:templateinline _ForwardIterator uninitialized_copy(_InputIterator __first, _InputIterator __last,_ForwardIterator __result) templateinline void uninit

2012-09-27 11:03:48 814

原创 常规函数适配器,成员函数适配器

stl算法中,可以使用函数指针以及仿函数传递算法.那么为什么还需要常规函数适配器呢?因为,常规函数适配器无"配接能力"例子:/* * File: main.cpp * Author: Vicky.H * Email: eclipser@163.com */#include #include #include #include clas

2012-09-24 16:51:13 1216

原创 关于type_info与typeid

不同编译器的返回结果不同!更多请参见:http://www.cppblog.com/smagle/archive/2010/05/14/115286.html/* * File: main.cpp * Author: Vicky.H * Email: eclipser@163.com */#include #include class A {};

2012-09-20 14:13:40 5446

原创 多态的实现方式,继承与模版函数

stl,boost中几乎所有容器都采用的是模版类+模版算法的方式实现多态,因为其效率更高!究其原因,静态编译/* * File: main.cpp * Author: Vicky.H * */#include /**动物*/class Animal {public: virtual ~Animal() { }; virtual

2012-09-20 11:50:24 846

原创 throw(),空异常描述符,中断描述符

在分析stl源码的时候,发现几乎所有函数都包含空异常描述符throw().那么throw()究竟有何意义呢?其实,与其称其为"空异常描述符",还不如称其为"中断描述符".简单的说,如果throw()修饰的函数中发生任何异常,即便函数外部有捕获操作,函数也不会抛出任何异常,那么程序将直接终止!!!简单的说,对使用throw()修饰的函数进行try{}catch(...){}是没有任何意义的!

2012-09-19 18:04:51 2880

原创 常规友元函数,模版友元函数以及友元类.

友元函数和友元类        采用类的机制后实现了数据的隐藏与封装,类的数据成员一般定义为私有成员,成员函数一般定义为公有的,依此提供类与外界间的通信接口。但是,有时需要定义一些函数,这些函数不是类的一部分,但又需要频繁地访问类的数据成员,这时可以将这些函数定义为该函数的友元函数。除了友元函数外,还有友元类,两者统称为友元。友元的作用是提高了程序的运行效率(即减少了类型检查和安全性检

2012-09-15 14:48:44 1739

原创 windows下,使用netbeans远程连接solaris11开发C++,并且使用DTrace工具

1.VM虚拟机安装sol-11-1111-text-x86.iso 2.安装完毕,查看gcc以及gdb版本.gcc -vgdb -vsol-11-1111-text-x86 不会默认安装gnu gcc 编译器,需要自己下载安装. 3.安装c++ 编译器.首先查看最新版本的gccroot@vicky:~# pkg search gccINDEX

2012-09-07 14:41:48 1475

原创 关于__type_traits的设计思想

/* * File: main.cpp * Author: Vicky.H * *///#include #include namespace cn_vicky { /** 2两个空白类,没有任何成员,不会带来额外负担,却能通过类型代表真假,可以用于函数特化参数 */ struct __true_type { }; s

2012-09-05 13:13:31 1160

原创 多参数返回类型_自定义tuple

/* * File: main.cpp * Author: Administrator * */// Java 中可以使用Object[] 方式用于返回多个值的函数,因为Java可以使用Object[] objs = fun()的方式接收,// 最重要的是,objs的长度在Java程序中是可知的,而如果C++中却不行!// public static Obje

2012-09-02 21:52:28 1177

原创 使用模版类作为模版参数

/* * File: main.cpp * Author: Administrator * */#include //-------------------namespace trait { template struct type_init; template <> struct type_init {

2012-09-02 20:41:43 4065 2

原创 类模版中函数模版

/* * File: main.cpp * Author: Administrator * */#include template class A {public: void f1(void); static void f2(void); /**模版类中的模版函数,在类模版A未被特化前,虽然可以声明与定义,

2012-09-01 23:55:47 999

JPA2.0-Spring2.x-Struts2注解

主要讲述JPA2.0规范,Struct2 Spring注解等技术

2012-02-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除