Namespaces
Variants

std::contracts:: contract_violation

From cppreference.net
Utilities library
Contract support
Contract-violation information
contract_violation
(C++26)
Helper functions
헤더에 정의됨 <contracts>
class contract_violation ;
(C++26부터)

클래스 std::contracts::contract_violation 는 특정 평가 의미론을 가진 계약 단언문 평가 중 감지된 계약 위반을 나타내는 데 사용되는 객체의 유형을 정의합니다.

이 타입의 객체는 구현체가 contract-violation handler 를 호출해야 할 때만 생성할 수 있습니다. 사용자는 이러한 객체를 직접 생성할 수 없습니다.

목차

멤버 함수

(constructor)
[deleted]
contract_violation 객체는 사용자가 생성할 수 없음
(public member function)
operator=
[deleted]
contract_violation 객체는 대입할 수 없음
(public member function)
(destructor)
[possibly virtual]
contract_violation 객체를 파괴함
(public member function)
일반 계약 위반 정보
kind
위반된 계약 어서션의 종류를 반환함
(public member function)
semantic
계약 위반 발생 시 평가 의미론을 반환함
(public member function)
is_terminating
평가 의미론이 종료 의미론인지 여부를 반환함
(public member function)
detection_mode
계약 위반을 발생시킨 원인을 반환함
(public member function)
evaluation_exception
술어 평가에서 발생한 예외에 대한 std::exception_ptr 를 반환함
(public member function)
기타 계약 위반 정보
comment
계약 위반에 대한 설명 문자열을 반환함
(public member function)
location
계약 위반 위치를 나타내는 std::source_location 을 반환함
(public member function)

std::contracts::contract_violation:: contract_violation

contract_violation ( const contract_violation & ) = delete ;
(C++26부터)

복사 생성자는 삭제된 것으로 정의됩니다. std::contracts::contract_violation CopyConstructible 을 만족하지 않습니다.

참고

다른 생성자들은 내부 사용 전용이며, 사용자가 접근할 수 없습니다.

std::contracts::contract_violation:: operator=

contract_violation & operator = ( const contract_violation & ) = delete ;
(C++26부터)

복사 할당 연산자는 삭제된 것으로 정의됩니다. std::contracts::contract_violation CopyAssignable 을 만족하지 않습니다.

std::contracts::contract_violation:: ~contract_violation

/* see below */ ~contract_violation ( ) ;
(C++26부터)

contract_violation 객체를 파괴합니다.

참고 사항

소멸자가 가상(virtual)인지 여부는 구현에 따라 정의됩니다.

std::contracts::contract_violation:: kind

std :: contracts :: assertion_kind kind ( ) const noexcept ;
(C++26부터)

반환값

위반된 계약 어서션의 구문 형태에 해당하는 열거자 값을 반환합니다.

std::contracts::contract_violation:: semantic

std :: contracts :: evaluation_semantic semantic ( ) const noexcept ;
(C++26부터)

반환값

위반된 계약 어서션이 평가된 평가 의미론에 해당하는 열거자 값을 반환합니다.

std::contracts::contract_violation:: is_terminating

bool is_terminating ( ) const noexcept ;
(C++26부터)

반환값

평가 의미론이 종료 의미론(terminating semantic) 인 경우 true 를 반환합니다. 그렇지 않으면 false 를 반환합니다.

std::contracts::contract_violation:: detection_mode

std :: contracts :: detection_mode detection_mode ( ) const noexcept ;
(C++26부터)

반환값

계약 위반을 발생시킨 원인에 해당하는 열거자 값을 반환합니다.

std::contracts::contract_violation:: evaluation_exception

std:: exception_ptr evaluation_exception ( ) const noexcept ;
(C++26부터)

반환값

계약 위반이 술어(predicate) 평가 중 예외로 인해 발생한 경우, 해당 예외 또는 그 예외의 복사본을 참조하는 std::exception_ptr 객체를 반환합니다. 그렇지 않은 경우 null std::exception_ptr 객체를 반환합니다.

std::contracts::contract_violation:: comment

const char * comment ( ) const noexcept ;
(C++26부터)

반환값

구현 정의된 null-terminated multibyte string ordinary literal encoding 으로 반환합니다.

참고

C++ 표준은 반환된 문자열이 위반된 계약 어설션의 술어(predicate)의 텍스트 표현을 포함하거나, 텍스트 표현 저장이 바람직하지 않은 경우 빈 문자열을 포함할 것을 권장합니다.

std::contracts::contract_violation:: location

std:: source_location location ( ) const noexcept ;
(C++26부터)

반환값

구현 정의 값을 가진 std::source_location 객체를 반환합니다.

참고

C++ 표준은 반환되는 값이 기본 생성된 std::source_location 객체이거나 위반된 계약 단언을 식별하는 값이어야 한다고 권장합니다:

  • 가능한 경우, 위반된 계약 단언이 선조건 단언 이었다면 함수 호출의 소스 위치가 반환되어야 합니다.
  • 그렇지 않으면 계약 단언의 소스 위치가 반환되어야 합니다.