프로그래밍 언어/C++

array-to-pointer conversion에 대해

opencpp 2024. 2. 24. 13:57
반응형

conversion의 설계 개념

C++의 conversion를 정의할 때, 직교하는 3 요소, value category, cv-qualification, data representation를 설계 개념으로 사용한다. conversion를 설계할 때, 요소 중 하나만을 변형하고, 다른 요소를 변형하지 않는다. 어떤 이유로, 예를 들어 하위 호환성을 위해, 설계 개념을 위반할 때는 스펙 문서는 관련된 특수 조항을 별도로 명시한다.

array-to-pointer conversion

value category 요소를 변형하기 위해 설계한 conversion이다. value category 요소만 변경하기 때문에, exact match rank로 분류된다. 또한 일반적으로 cv-qualification이나 data representation를 변경하지 않는다.

temporary materialization conversion를 사용해, 배열 T[N] 또는 T[]prvalue categoryxvalue category로 변경한다.

array-to-pointer conversion는 배열 T[N] 또는 T[]lvalue categorytemporary materialization conversion를 적용한 xvalue category에서 T의 pointer prvalue category로 변경한다.

결국, array 타입에 대한 glvalue-to-prvalue conversion이 바로, array-to-pointer conversion이다.

반응형