gpt4 book ai didi

c++ - 从非常量到常量的转换示例

转载 作者:行者123 更新时间:2023-11-30 02:03:31 25 4
gpt4 key购买 nike

<分区>

引自 C++ Primer,第 4 版:

The rules for when an exception matches a catch exception specifier are much more restrictive than the rules used for matching arguments with parameter types. Most conversions are not allowedthe types of the exception and the catch specifier must match exactly with only a few possible differences:

1.Conversions from nonconst to const are allowed. That is, a throw of a nonconst object can match a catch specified to take a const reference.

您能举个例子来解释第一个术语吗?非常感谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com