Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/c++/15/experimental/contract
1 // Contracts support header for -*- C++ -*- 2 3 // Copyright (C) 2019-2025 Free Software Foundation, Inc. 4 // 5 // This file is part of GCC. 6 // 7 // GCC is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License as published by 9 // the Free Software Foundation; either version 3, or (at your option) 10 // any later version. 11 // 12 // GCC is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // Under Section 7 of GPL version 3, you are granted additional 18 // permissions described in the GCC Runtime Library Exception, version 19 // 3.1, as published by the Free Software Foundation. 20 21 // You should have received a copy of the GNU General Public License and 22 // a copy of the GCC Runtime Library Exception along with this program; 23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 // <http://www.gnu.org/licenses/>. 25 26 /** @file contract 27 * This is a Standard C++ Library header. 28 */ 29 30 #ifndef _GLIBCXX_CONTRACT 31 #define _GLIBCXX_CONTRACT 1 32 33 #ifdef _GLIBCXX_SYSHDR 34 #pragma GCC system_header 35 #endif 36 37 #if __cplusplus >= 201703L 38 39 #include <string_view> 40 #include <cstdint> 41 42 namespace std _GLIBCXX_VISIBILITY(default) 43 { 44 _GLIBCXX_BEGIN_NAMESPACE_VERSION 45 46 namespace experimental 47 { 48 // From P1332 49 enum class contract_violation_continuation_mode { 50 never_continue, maybe_continue 51 }; 52 53 class contract_violation { 54 const char* _M_file; 55 const char* _M_function; 56 const char* _M_comment; 57 const char* _M_level; 58 const char* _M_role; 59 uint_least32_t _M_line; 60 signed char _M_continue; 61 public: 62 // From N4820 63 uint_least32_t line_number() const noexcept { return _M_line; } 64 string_view file_name() const noexcept { return _M_file; } 65 string_view function_name() const noexcept { return _M_function; } 66 string_view comment() const noexcept { return _M_comment; } 67 string_view assertion_level() const noexcept { return _M_level; } 68 // From P1332 69 string_view assertion_role() const noexcept { return _M_role; } 70 contract_violation_continuation_mode continuation_mode() const noexcept 71 { return static_cast<contract_violation_continuation_mode>(_M_continue); } 72 }; 73 74 } // namespace experimental 75 76 _GLIBCXX_END_NAMESPACE_VERSION 77 } // namespace std 78 79 // To override the contract violation handler, define 80 //void ::handle_contract_violation (const std::experimental::contract_violation &); 81 82 #endif // C++17 83 #endif // _GLIBCXX_CONTRACT