---
name: "std::tuple"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::tuple/3cxx"
---

# std::tuple(3cxx)

Primary class template, tuple.

## NAME

std::tuple\< \_Elements \> - Primary class template, tuple.

## SYNOPSIS

`#include <tuple>`

Inherits **std::\_Tuple\_impl\< 0, \_Elements... \>**.

### Public Member Functions

template\<typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), **\_ImplicitCtor**\< **\_Valid**, \_UElements... \>  = true\> constexpr **tuple** (**\_UElements** &&... **\_\_elements**) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 template\<typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), **\_ExplicitCtor**\< **\_Valid**, \_UElements... \>  = false\> constexpr **tuple** (**\_UElements** &&... **\_\_elements**) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 template\<**typename** \_Alloc , **\_ImplicitDefaultCtor**\< **is\_object**\< \_Alloc \>::value \>  = true\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a)\
 template\<**typename** \_Alloc , **\_ExplicitDefaultCtor**\< **is\_object**\< \_Alloc \>::value \>  = false\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), **\_ImplicitCtor**\< **\_Valid**, \_UElements... \>  = true\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, **\_UElements** &&... **\_\_elements**)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), **\_ExplicitCtor**\< **\_Valid**, \_UElements... \>  = false\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, **\_UElements** &&... **\_\_elements**)\
 template\<**typename** \_Alloc , bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), **\_ImplicitCtor**\< **\_NotEmpty**, const \_Elements &... \>  = true\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, const \_Elements &... **\_\_elements**)\
 template\<**typename** \_Alloc , bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), **\_ExplicitCtor**\< **\_NotEmpty**, const \_Elements &... \>  = false\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, const \_Elements &... **\_\_elements**)\
 template\<**typename** \_Alloc \> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, const **tuple** &**\_\_in**)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<const tuple\<\_UElements...\>&\>(), **\_ImplicitCtor**\< **\_Valid**, const **\_UElements** &... \>  = true\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, const **tuple**\< \_UElements... \> &**\_\_in**)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<const tuple\<\_UElements...\>&\>(), **\_ExplicitCtor**\< **\_Valid**, const **\_UElements** &... \>  = false\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, const **tuple**\< \_UElements... \> &**\_\_in**)\
 template\<**typename** \_Alloc \> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, **tuple** &&**\_\_in**)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<tuple\<\_UElements...\>&&\>(), **\_ImplicitCtor**\< **\_Valid**, \_UElements... \>  = true\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, **tuple**\< \_UElements... \> &&**\_\_in**)\
 template\<**typename** \_Alloc , typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<tuple\<\_UElements...\>&&\>(), **\_ExplicitCtor**\< **\_Valid**, \_UElements... \>  = false\> constexpr **tuple** (**allocator\_arg\_t** **\_\_tag**, const \_Alloc &\_\_a, **tuple**\< \_UElements... \> &&**\_\_in**)\
 template\<bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), **\_ImplicitCtor**\< **\_NotEmpty**, const \_Elements &... \>  = true\> constexpr **tuple** (const \_Elements &... **\_\_elements**) noexcept(\_\_nothrow\_constructible\< const \_Elements &... \>())\
 template\<bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), **\_ExplicitCtor**\< **\_NotEmpty**, const \_Elements &... \>  = false\> constexpr **tuple** (const \_Elements &... **\_\_elements**) noexcept(\_\_nothrow\_constructible\< const \_Elements &... \>())\
 constexpr **tuple** (const **tuple** &)=**default**\
 template\<typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<const tuple\<\_UElements...\>&\>(), **\_ImplicitCtor**\< **\_Valid**, const **\_UElements** &... \>  = true\> constexpr **tuple** (const **tuple**\< \_UElements... \> &**\_\_in**) noexcept(\_\_nothrow\_constructible\< const **\_UElements** &... \>())\
 template\<typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<const tuple\<\_UElements...\>&\>(), **\_ExplicitCtor**\< **\_Valid**, const **\_UElements** &... \>  = false\> constexpr **tuple** (const **tuple**\< \_UElements... \> &**\_\_in**) noexcept(\_\_nothrow\_constructible\< const **\_UElements** &... \>())\
 constexpr **tuple** (**tuple** &&)=**default**\
 template\<typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<tuple\<\_UElements...\>&&\>(), **\_ImplicitCtor**\< **\_Valid**, \_UElements... \>  = true\> constexpr **tuple** (**tuple**\< \_UElements... \> &&**\_\_in**) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 template\<typename... \_UElements, bool \_Valid = (sizeof...(\_Elements) == sizeof...(\_UElements)) && !\_\_use\_other\_ctor\<tuple\<\_UElements...\>&&\>(), **\_ExplicitCtor**\< **\_Valid**, \_UElements... \>  = false\> constexpr **tuple** (**tuple**\< \_UElements... \> &&**\_\_in**) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 constexpr **tuple** & **operator=** (\_\_conditional\_t\< \_\_assignable\< \_Elements... \>(), **tuple** &&, **\_\_nonesuch** && \> **\_\_in**) noexcept(\_\_nothrow\_assignable\< \_Elements... \>())\
 constexpr **tuple** & **operator=** (\_\_conditional\_t\< \_\_assignable\< const \_Elements &... \>(), const **tuple** &, const **\_\_nonesuch** & \> **\_\_in**) noexcept(\_\_nothrow\_assignable\< const \_Elements &... \>())\
 template\<typename... \_UElements\> constexpr **\_\_enable\_if\_t**\< \_\_assignable\< const **\_UElements** &... \>(), **tuple** & \> **operator=** (const **tuple**\< \_UElements... \> &**\_\_in**) noexcept(\_\_nothrow\_assignable\< const **\_UElements** &... \>())\
 template\<typename... \_UElements\> constexpr **\_\_enable\_if\_t**\< \_\_assignable\< \_UElements... \>(), **tuple** & \> **operator=** (**tuple**\< \_UElements... \> &&**\_\_in**) noexcept(\_\_nothrow\_assignable\< \_UElements... \>())\
 constexpr **void** **swap** (**tuple** &**\_\_in**) noexcept(\_\_and\_\< **\_\_is\_nothrow\_swappable**\< \_Elements \>... \>::value)\

## Detailed Description

### template\<typename... \_Elements\>

class std::tuple\< \_Elements \>"Primary class template, tuple.

## Author

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