Open utterances-bot opened 1 year ago
Exercise 16.1 1 2 3 // instantiate // generate a spedified version of function or class based on template and passed in template arguments. Exercise 16.2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 template <typename T> int compare(const T &v1, const T &v2) { if(v1 < v2) return -1; if(v2 < v1) return 1; return 0; } int main() { compare(1, 2); // compare(Sales_data(), Sales_data()); // compiler error: // .
https://zero4drift.github.io/posts/cpp-primer-5th-exercises-chapter-16/
Nit, 16.34 b) is char[4] due to the null pointer.
Cpp-Primer-5th-Exercises-Chapter-16 - 找一个吃麦旋风的理由
Exercise 16.1 1 2 3 // instantiate // generate a spedified version of function or class based on template and passed in template arguments. Exercise 16.2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 template <typename T> int compare(const T &v1, const T &v2) { if(v1 < v2) return -1; if(v2 < v1) return 1; return 0; } int main() { compare(1, 2); // compare(Sales_data(), Sales_data()); // compiler error: // .
https://zero4drift.github.io/posts/cpp-primer-5th-exercises-chapter-16/