Skip to content

Commit 16d9a54

Browse files
author
msebolt
committed
cpp-reconcile-pr1
1 parent e21b45d commit 16d9a54

10 files changed

Lines changed: 357 additions & 13 deletions

docs/cpp/bad-cast-exception.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public:
2626
bad_cast(const char * _Message = "bad cast");
2727
bad_cast(const bad_cast &);
2828
virtual ~bad_cast();
29+
30+
bad_cast& operator=(const bad_cast&) noexcept;
31+
const char* what() const noexcept override;
2932
};
3033
```
3134

docs/cpp/bad-typeid-exception.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ The interface for **bad_typeid** is:
2424
class bad_typeid : public exception
2525
{
2626
public:
27+
bad_typeid();
2728
bad_typeid(const char * _Message = "bad typeid");
2829
bad_typeid(const bad_typeid &);
2930
virtual ~bad_typeid();
31+
32+
bad_typeid& operator=(const bad_typeid&);
33+
const char* what() const;
3034
};
3135
```
3236

docs/cpp/type-info-class.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ The `<typeinfo>` header file must be included in order to use the **type_info**
1414
```cpp
1515
class type_info {
1616
public:
17+
type_info(const type_info& rhs) = delete; // cannot be copied
1718
virtual ~type_info();
18-
size_t hash_code() const
19+
size_t hash_code() const;
1920
_CRTIMP_PURE bool operator==(const type_info& rhs) const;
21+
type_info& operator=(const type_info& rhs) = delete; // cannot be copied
2022
_CRTIMP_PURE bool operator!=(const type_info& rhs) const;
2123
_CRTIMP_PURE int before(const type_info& rhs) const;
24+
size_t hash_code() const noexcept;
2225
_CRTIMP_PURE const char* name() const;
2326
_CRTIMP_PURE const char* raw_name() const;
2427
};

docs/standard-library/bad-exception-class.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ The class describes an exception that can be thrown from an unexpected handler.
1313

1414
```cpp
1515
class bad_exception : public exception {};
16+
17+
bad_exception();
18+
bad_exception(const bad_exception&);
19+
bad_exception& operator=(const bad_exception&);
20+
const char* what() const override;
1621
```
1722
1823
## Remarks

docs/standard-library/exception-functions.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ helpviewer_keywords: ["std::current_exception [C++]", "std::get_terminate [C++]"
1010
||||
1111
|-|-|-|
1212
|[current_exception](#current_exception)|[get_terminate](#get_terminate)|[get_unexpected](#get_unexpected)|
13-
|[make_exception_ptr](#make_exception_ptr)|[rethrow_exception](#rethrow_exception)|[set_terminate](#set_terminate)|
14-
|[set_unexpected](#set_unexpected)|[terminate](#terminate)|[uncaught_exception](#uncaught_exception)|
15-
|[unexpected](#unexpected)|
13+
|[make_exception_ptr](#make_exception_ptr)|[rethrow_exception](#rethrow_exception)|[rethrow_if_nested](#rethrow_if_nested)|
14+
|[set_terminate](#set_terminate)|[set_unexpected](#set_unexpected)|][throw_if_nested](#throw_if_nested)|
15+
|[terminate](#terminate)|[uncaught_exception](#uncaught_exception)|[unexpected](#unexpected)|
1616

17-
## <a name="current_exception"></a> current_exception
17+
## <a name="current_exception"></a> current_exception
1818

1919
Obtains a smart pointer to the current exception.
2020

@@ -142,7 +142,14 @@ Obtains the current `unexpected_handler` function.
142142
unexpected_handler get_unexpected();
143143
```
144144

145-
## <a name="set_unexpected"></a> set_unexpected
145+
## <a name="rethrow_if_nested"> rethrow_if_nested
146+
147+
```cpp
148+
template <class E>
149+
void rethrow_if_nested(const E& e);
150+
```
151+
152+
## <a name="set_unexpected"></a> set_unexpected
146153
147154
Establishes a new `unexpected_handler` to be when an unexpected exception is encountered.
148155
@@ -208,6 +215,13 @@ A terminate handler may not return to its caller. At program startup, the termin
208215

209216
See [set_unexpected](../standard-library/exception-functions.md#set_unexpected) for an example of the use of `terminate`.
210217

218+
## <a name="throw_if_nested"> throw_if_nested
219+
220+
```cpp
221+
template <class T> [[noreturn]]
222+
void throw_with_nested(T&& t);
223+
```
224+
211225
## <a name="uncaught_exception"></a> uncaught_exception
212226
213227
Returns **true** only if a thrown exception is being currently processed.

docs/standard-library/exception.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ Defines several types and functions related to the handling of exceptions. Excep
3232
|[get_unexpected](../standard-library/exception-functions.md#get_unexpected)|Obtains the current `unexpected_handler` function.|
3333
|[make_exception_ptr](../standard-library/exception-functions.md#make_exception_ptr)|Creates an `exception_ptr` object that holds a copy of an exception.|
3434
|[rethrow_exception](../standard-library/exception-functions.md#rethrow_exception)|Throws an exception passed as a parameter.|
35+
|[rethrow_if_nested](../standard-library/exception-functions.md#rethrow_if_nested)||
3536
|[set_terminate](../standard-library/exception-functions.md#set_terminate)|Establishes a new `terminate_handler` to be called at the termination of the program.|
3637
|[set_unexpected](../standard-library/exception-functions.md#set_unexpected)|Establishes a new `unexpected_handler` to be when an unexpected exception is encountered.|
3738
|[terminate](../standard-library/exception-functions.md#terminate)|Calls a terminate handler.|
39+
|[throw_with_nested](../standard-library/exception-functions.md#throw_with_nested)||
3840
|[uncaught_exception](../standard-library/exception-functions.md#uncaught_exception)|Returns **true** only if a thrown exception is being currently processed.|
3941
|[unexpected](../standard-library/exception-functions.md#unexpected)|Calls an unexpected handler.|
4042

@@ -44,6 +46,7 @@ Defines several types and functions related to the handling of exceptions. Excep
4446
|-|-|
4547
|[bad_exception Class](../standard-library/bad-exception-class.md)|The class describes an exception that can be thrown from an `unexpected_handler`.|
4648
|[exception Class](../standard-library/exception-class.md)|The class serves as the base class for all exceptions thrown by certain expressions and by the C++ Standard Library.|
49+
|[nested_exception Class](../standard-library/nested-exception-class.md)||
4750

4851
## See also
4952

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: "nested_exception Class"
3+
ms.date: "11/04/2016"
4+
f1_keywords: ["exception/std::bad_exception"]
5+
helpviewer_keywords: ["bad_exception class"]
6+
ms.assetid: 5ae2c4ef-c7ad-4469-8a9e-a773e86bb000
7+
---
8+
# bad_exception Class
9+
10+
The class describes an exception that can be thrown from an unexpected handler.
11+
12+
## Syntax
13+
14+
```cpp
15+
class nested_exception {
16+
public: nested_exception();
17+
nested_exception(const nested_exception&) noexcept = default;
18+
nested_exception& operator=(const nested_exception&) noexcept = default;
19+
virtual ~nested_exception() = default; // access functions [[noreturn]]
20+
void rethrow_nested() const;
21+
exception_ptr nested_ptr() const noexcept;
22+
};
23+
24+
template<class T> [[noreturn]] void throw_with_nested(T&& t); template <class E> void rethrow_if_nested(const E& e);
25+
26+
27+
template<class T> [[noreturn]] void throw_with_nested(T&& t); template <class E> void rethrow_if_nested(const E& e);
28+
}
29+
30+
void rethrow_nested() const;
31+
32+
```
33+
34+
## Remarks
35+
36+
[unexpected](../standard-library/exception-functions.md#unexpected) will throw a `bad_exception` instead of terminating or instead of calling another function specified with [set_unexpected](../standard-library/exception-functions.md#set_unexpected) if `bad_exception` is included in the throw list of a function.
37+
38+
The value returned by `what` is an implementation-defined C string. None of the member functions throw any exceptions.
39+
40+
For a list of members inherited by the `bad_exception` class, see [exception Class](../standard-library/exception-class.md).
41+
42+
## Example
43+
44+
See [set_unexpected](../standard-library/exception-functions.md#set_unexpected) for an example of the use of [unexpected](../standard-library/exception-functions.md#unexpected) throwing a `bad_exception`.
45+
46+
## Requirements
47+
48+
**Header:** \<exception>
49+
50+
**Namespace:** std
51+
52+
## See also
53+
54+
[exception Class](../standard-library/exception-class.md)<br/>
55+
[Thread Safety in the C++ Standard Library](../standard-library/thread-safety-in-the-cpp-standard-library.md)<br/>

0 commit comments

Comments
 (0)