c++_primer_exercise_1632_1633_1634

来源:互联网 发布:颜真卿书法 知乎 编辑:程序博客网 时间:2024/04/30 06:10

Exercise 16.32:

The compiler examines the types of the argument that were specified using a template parameter. It automatically instantiates a version of the function with those types or values bound to the template paramter.


Exercise 16.33:

const conversions: A function parameter that is a reference(or pointer) to a const can be passed a reference(or pointer) to a nonconst object.

Array- or function-to-pointer conversions: If the function parameter is not a reference type, then the normal pointer conversion will be applied to arguments of array or function type. An array argument will be converted to a pointer to its first element. Similarly, a function argument will be converted to the function's type.


Exercise 16.34:

(a) illegal. When the parameter is a reference, the arrays are not converted to pointers. one is converted to "a reference to const char [3]", and the other is converted to "a reference to const char [6]".

(b) legal.

0 0
原创粉丝点击