问题 单项选择题

关于在调用模板函数时模板实参的使用,下列表述中正确的是( )。

A.对于虚拟类型参数所对应的模板实参,如果能从模板函数的实参中获得相同的信息,则都可以省略

B.对于虚拟类型参数所对应的模板实参,如果它们是参数表中的最后的若干个参数,则都可以省略

C.对于虚拟类型参数所对应的模板实参,若能够省略则必须省略

D.对于常规参数所对应的模板实参,任何情况下都不能省略

答案

参考答案:D

解析: 以下情况模板实参不能省略:从模板函数实参表获得的信息有矛盾;需要获得特定类型的返回值,而不管返回值类型如何;虚拟类型的参数没有出现在模板形参表中;函数模板含有常规形参。

填空题

When I was growing up, I was embarrassed to be seen with my father. He (1) severely crippled and very short, and when we would walk together, his hand on my arm (2) balance, people would stare. I would inwardly be afraid (3) squirm at the unwanted attention. If he ever noticed or was bothered, he never let (4) .
It was difficult to coordinate (5) steps - his halting, mine impatient - and because of that, we didn’t say much as we went along. But as we started out, he always said, "You (6) the pace. I will try to adjust to you. "
Our usual walk was to or (7) the subway, which was how he got to (8) . He went to work sick, and (9) nasty weather. He almost never missed a day, and would (10) it to the office even if (11) could not: a matter of pride!
He never talked about himself as an object of pity, (12) did he show any envy of the more fortunate or able. What he looked for in others was a "good heart", and if he found one, the owner was good enough for him.
Now that I am older, I believe that is a proper standard (13) which to judge people, even though I still don’t know precisely (14) a "good heart" is. But I know the times I don’t have one myself.
He has (15) gone many years now, but I think (16) him often. I wonder if he sensed my reluctance to be seen with him during our (17) . If he did, I am (18) I never told him how sorry I was, how unworthy I was, how I regretted it. I think of him when I complain about trifles, when I am (19) of another’s good fortune, when I don’t have a "good heart".
At such times I put my hand on his arm to regain my (20) , and say, "You set the pace, I will try to adjust to you.\

单项选择题