12 2016 档案
摘要:#include #include struct cmp_str{ bool operator()(char const* a, char const* b){ return std::strcmp(a, b) v;//此时比较的是指针的值,今天差点这样用,如果这样需要自己写比较器 const char* a = "bello"; const cha...
阅读全文
摘要://类成员函数模板特化 #include class A{ public: template void Print(){ printf("A template\n"); } }; template void A::Print(){ printf("int\n"); } int main(){ A a; a.Print(); ...
阅读全文
摘要:#include template T max(T x, T y) { return x > y ? x : y; } //函数模板特化 template const char* max(const char* x, const char* y){ return strcmp(x, y) > 0 ? x : y; } int main(){ std::cout ...
阅读全文