1// Standard exception classes -*- C++ -*-
3// Copyright (C) 2001-2026 Free Software Foundation, Inc.
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
25/** @file include/stdexcept
26 * This is a Standard C++ Library header.
30// ISO C++ 19.1 Exception classes
33#ifndef _GLIBCXX_STDEXCEPT
34#define _GLIBCXX_STDEXCEPT 1
37#pragma GCC system_header
42#include <bits/stdexcept_except.h>
44namespace std _GLIBCXX_VISIBILITY(default)
46_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 * @addtogroup exceptions
53 /** Thrown to indicate range errors in internal computations. */
54 class range_error : public runtime_error
57#if __cpp_lib_constexpr_exceptions >= 202502L
58 constexpr explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE
59 : runtime_error(__arg) { }
60 constexpr explicit range_error(const char* __arg) _GLIBCXX_TXN_SAFE
61 : runtime_error(__arg) { }
62 constexpr range_error(const range_error&) = default;
63 constexpr range_error& operator=(const range_error&) = default;
64 constexpr range_error(range_error&&) = default;
65 constexpr range_error& operator=(range_error&&) = default;
66 constexpr virtual ~range_error() noexcept { }
68 explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE;
69#if __cplusplus >= 201103L
70 explicit range_error(const char*) _GLIBCXX_TXN_SAFE;
71 range_error(const range_error&) = default;
72 range_error& operator=(const range_error&) = default;
73 range_error(range_error&&) = default;
74 range_error& operator=(range_error&&) = default;
76 virtual ~range_error() _GLIBCXX_NOTHROW;
80 /// @} group exceptions
82_GLIBCXX_END_NAMESPACE_VERSION
85#endif /* _GLIBCXX_STDEXCEPT */