
c++
iteye_10111
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
类成员函数模板特化
//header file namespace odbclib { class MemoryBlock { public: typedef unsigned char byte; explicit MemoryBlock(size_t = 0xff) throw(runtime_error); MemoryBlock(MemoryBlock const&am...原创 2011-06-12 20:20:06 · 285 阅读 · 0 评论 -
二级指针 const 参数
http://www.parashift.com/c++-faq-lite/constptrptr-conversion.html 写道 [18.17] Why am I getting an error converting a Foo** → Foo const**? Because converting Foo** → Foo const** would be invalid and ...原创 2013-01-11 22:33:19 · 285 阅读 · 0 评论 -
tricks
#include <typeinfo> #include <cstdlib> #include <iostream> #include <string> #include <vector> #include <list> using namespace std; template< template...2012-12-31 14:21:41 · 109 阅读 · 0 评论 -
多输出带前缀输出流
http://stackoverflow.com/questions/2212776/overload-handling-of-stdendl 写道 #include <iostream> #include <sstream> class MyStream: public std::ostream { // Write a stream buffer th...2012-10-29 11:37:12 · 129 阅读 · 0 评论 -
inherit the ostream
class cdebug_stream :public ostream { public: typedef cdebug_stream& (*manip_fnptr)(cdebug_stream&); void attach(ostream& os) { m_outs.push_back(&os); } void detach(ostream&...2012-10-26 16:02:43 · 111 阅读 · 0 评论 -
模板参数 函数指针
http://stackoverflow.com/questions/5507377/template-type-deduction-for-a-pointer-to-member-function 写道 For a.connect<double> (&GApp::foo), both the foo(double) and foo(double, double) wi...原创 2011-12-22 13:12:04 · 170 阅读 · 0 评论 -
event
#ifndef ODBCLIB_CORE_EVENT_EVENT_H #define ODBCLIB_CORE_EVENT_EVENT_H #include "Event.template" #include "Event.implement" #endif #ifndef ODBCLIB_CORE_EVENT_EVENT_TEMPLATE #define ODBCLIB...2011-08-19 14:42:23 · 111 阅读 · 0 评论 -
c++ Delegate
#ifndef DUMMYCLASS_H #define DUMMYCLASS_H namespace delegate { class DummyClass{}; } #endif #ifndef METHODSTORAGE_H #define METHODSTORAGE_H #include "DummyClass.h" namespac...2011-08-06 19:59:26 · 155 阅读 · 0 评论 -
Nullable (bug)
#ifndef NULLABLE_H #define NULLABLE_H #include "odbclib.h" namespace odbclib { template<typename T> class Nullable { typedef T const& const_reference; typedef T const* cons...2011-06-26 23:45:40 · 127 阅读 · 0 评论 -
C++ 接异常时的注意
void test1() { try { try { throw runtime_error("asdfasdf"); } catch(std::exception &e) { throw e; } } catch(std::runtime_error &e) { throw e; } ...2011-06-24 23:55:45 · 107 阅读 · 0 评论 -
类成员函数模板特化 默认参数
#ifndef MEMORYBLOCK_H #define MEMORYBLOCK_H #include "odbclib.h" #include <cstdlib> using std::min; namespace odbclib { class MemoryBlock { public: typedef unsigned char ...原创 2011-06-19 11:23:04 · 253 阅读 · 0 评论 -
关于抛出异常和清栈
构造函数中异常: 1.在无继承关系的前提下,构造函数中抛出异常未尝不可。 因为在对象没能构造完整的情况下,是不会去调用析构函数的。 2.在有继承关系的情况下,构造函数中抛出异常可能会引起问题 2.1如果基类中有纯虚函数,而且在基类的析构函数中有被调用的话,会得到一个 pure virtual function call的异常 2.2如果基类中有纯虚函数,但是基类的析构函数中没有...2011-06-18 22:10:22 · 187 阅读 · 0 评论 -
pthread_rwlock_t 未定义的问题
最近在linux上次编译时出现pthread_rwlock_t没有定义的现象.但是已经include了pthread.h,网上查了一些资料后发现,原因竟然是因为显示使用了-std=c99参数导致. 在c99没有完全实现时,如果不显示指定-std, 则gcc默认使用gnu89(或gnu90)标准. 一般而言, gnuXX标准 = cXX标准 + GNU ...原创 2016-08-06 15:02:25 · 1382 阅读 · 0 评论