От: | Юрий Жмеренецкий | ICQ 380412032 | |
Дата: | 14.02.09 06:02 | ||
Оценка: | 103 (10) |
// Некоторые куски из параграф 13 нарисовал в БНФ (в скобках - сокращения):
implicit conversion sequence (ICS) :=
standard conversion sequence (SCS)
| user-defined conversion sequence (UDCS)
| ellipsis conversion sequence
SCS :=
Identity
| Category_list
Category_list :=
Category Category_opt Category_opt // + правила из 13.3.3.1.1/2
// User-defined conversion sequence Представляет собой(13.3.3.1.2/1)
// последовательность из следующих обязательных частей:
// 1) initial SCS
// 2) user-defined conversion (UDC) // не UDCS!
// 3) second SCS
UDCS :=
SCS UDC SCS
UDC :=
Conversion_function
| ...
check(Host<B,D>(), int())
UDCS1:
1) H -> H [SCS]{Identity}
2) H -> D* [UDC]
3) D* -> D* [SCS]{Identity}
UDCS2.1:
1) H -> H [SCS]{Identity}
1) H -> D* [UDC]
2) D* -> B* [SCS]{Pointer conversion}
UDCS2.2
1) H -> H const [SCS]{Qualification Adjustment}
2) H const -> B* [UDC]
3) B* -> B* [SCS]{Identity}
When the parameter type is not a reference, the implicit conversion sequence models a copy-initialization of the parameter from the argument expression.
User-defined conversion sequence U1 is a better conversion sequence than another user-defined conversion sequence U2 if they contain the same user-defined conversion function or constructor and if the second standard conversion sequence of U1 is better than the second standard conversion sequence of U2.
UDCS1:
1) H -> H [SCS]{Identity}
2) H -> D* [UDC]
3) D* -> D* [SCS]{Identity}
UDCS2
1) H -> H const [SCS]{Qualification Adjustment}
2) H const -> B* [UDC]
3) B* -> B* [SCS]{Identity}