---
name: "std::nested_exception"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::nested_exception"
---

# std::nested\_exception(3)

## NAME

std::nested\_exception

## SYNOPSIS

\#include \<exception\>

### Public Member Functions

**nested\_exception** () noexcept\
 The default constructor stores the current exception (if any).  **nested\_exception** (const nested\_exception &) noexcept=default\
 **exception\_ptr** **nested\_ptr** () const noexcept\
 Access the stored exception.  **nested\_exception** & **operator=** (const **nested\_exception** &) noexcept=default\
 void **rethrow\_nested** () const\
 Rethrow the stored exception, or terminate if none was stored.

## Detailed Description

Mixin class that stores the current exception.

This type can be used via std::throw\_with\_nested to store the current exception nested within another exception.

**Since**

C++11

**See also**

std::throw\_with\_nested

## Constructor & Destructor Documentation

### std::nested\_exception::nested\_exception () \[inline\], \[noexcept\]

The default constructor stores the current exception (if any).

References **std::current\_exception()**.

## Member Function Documentation

### exception\_ptr std::nested\_exception::nested\_ptr () const \[inline\], \[noexcept\]

Access the stored exception.

### void std::nested\_exception::rethrow\_nested () const \[inline\]

Rethrow the stored exception, or terminate if none was stored.

References **std::rethrow\_exception()**, **rethrow\_nested()**, and **std::terminate()**.

Referenced by **rethrow\_nested()**.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
