回复: Marco or trait or something magic ? >>why this can't be defined as a function template for DB?
>>//inside class definition
>>template<typename T>
>>bool insert(T x){ return insert(x.id, x); }
My point here is that the template class DB is provided with a generic type
, keyType and that the template class DB is served as a library. Therefore,
if the function template above is defined inside the class, because of its
hardcode, then the class DB can not be served as a library.
The recordType is limited to a POD type, that is the keyType must be one of
(int, long, double, and char*) only. |