查看单个帖子
  #2 (permalink)  
旧 2008-02-18
liuxinyu 的头像
liuxinyu liuxinyu 当前离线
高级会员
 
注册日期: 2006-02-09
帖子: 311
文章: 49
liuxinyu 正向着好的方向发展
默认 回复: Marco or trait or something magic ?

引用:
作者: mjus 查看帖子
代码:
//INSERT(x) for a shortcut. #define INSERT(x) Insert(x.id,x)
just quickly went through, why this can't be defined as a function template for DB?

as:
代码:
//inside class definition template<typename T> bool insert(T x){ return insert(x.id, x); }
if it is only applied to the POD record, the function template can be replaced by the specified recordType.
回复时引用此帖