stdcontract_violation(3)
std::contract_violation - std::contract_violation
Synopsis
Defined in header <contract> class contract_violation; (since C++20) The class contract_violation describes information about a contract_violation. It is generated by a C++ implementation and passed to a contract violation handler when a contract violation is detected.
Member functions
std::contract_violation::line_number
std::uint_least32_t line_number() const noexcept;
Returns the location of the source code where the contract violation happened. If the name is unknown, an implementation may return 0 instead.
std::contract_violation::file_name
std::string_view file_name() const noexcept;
Returns the name of the the source file where the contract violation happened. If the name is unknown, an implementation may return an empty string_view instead.
std::contract_violation::function_name
std::string_view function_name() const noexcept;
Returns the name of the function where the contract violation happened. If the name is unknown, an implementation may return an empty string_view instead.
std::contract_violation::comment
std::string_view comment() const noexcept;
Returns an implementation-defined string describing the predicate of the violated contract.
std::contract_violation::assertion_level
std::string_view assertion_level() const noexcept;
Returns a string describing the assertion level of the violated contract.