---
name: "std::tuple"
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::tuple"
---

# std::tuple(3)

Primary class template, tuple.

## NAME

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

## SYNOPSIS

\#include \<tuple\>

### Public Member Functions

template\<typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), \_ExplicitCtor\< \_Valid, \_UElements... \> = false\> constexpr **tuple** (\_UElements &&... \_\_elements) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 template\<typename... \_UElements, bool \_Valid = \_\_valid\_args\<\_UElements...\>(), \_ImplicitCtor\< \_Valid, \_UElements... \> = true\> constexpr **tuple** (\_UElements &&... \_\_elements) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 template\<typename \_Alloc, \_ExplicitDefaultCtor\< **is\_object**\< \_Alloc \>::value \> = false\> constexpr **tuple** (allocator\_arg\_t \_\_tag, const \_Alloc &\_\_a)\
 template\<typename \_Alloc, \_ImplicitDefaultCtor\< **is\_object**\< \_Alloc \>::value \> = true\> constexpr **tuple** (allocator\_arg\_t \_\_tag, const \_Alloc &\_\_a)\
 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, 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, bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), \_ExplicitCtor\< \_NotEmpty, const \_Elements &... \> = false\> constexpr **tuple** (allocator\_arg\_t \_\_tag, const \_Alloc &\_\_a, const \_\_type\_identity\_t\< \_Elements \> &... \_\_elements)\
 template\<typename \_Alloc, bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), \_ImplicitCtor\< \_NotEmpty, const \_Elements &... \> = true\> constexpr **tuple** (allocator\_arg\_t \_\_tag, const \_Alloc &\_\_a, const \_\_type\_identity\_t\< \_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...\>&\>(), \_ExplicitCtor\< \_Valid, const \_UElements &... \> = false\> 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...\>&\>(), \_ImplicitCtor\< \_Valid, const \_UElements &... \> = true\> 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...\>&&\>(), \_ExplicitCtor\< \_Valid, \_UElements... \> = false\> 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...\>&&\>(), \_ImplicitCtor\< \_Valid, \_UElements... \> = true\> constexpr **tuple** (allocator\_arg\_t \_\_tag, const \_Alloc &\_\_a, tuple\< \_UElements... \> &&\_\_in)\
 template\<bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), \_ExplicitCtor\< \_NotEmpty, const \_Elements &... \> = false\> constexpr **tuple** (const \_\_type\_identity\_t\< \_Elements \> &... \_\_elements) noexcept(\_\_nothrow\_constructible\< const \_Elements &... \>())\
 template\<bool \_NotEmpty = (sizeof...(\_Elements) \>= 1), \_ImplicitCtor\< \_NotEmpty, const \_Elements &... \> = true\> constexpr **tuple** (const \_\_type\_identity\_t\< \_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...\>&\>(), \_ExplicitCtor\< \_Valid, const \_UElements &... \> = false\> 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...\>&\>(), \_ImplicitCtor\< \_Valid, const \_UElements &... \> = true\> 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...\>&&\>(), \_ExplicitCtor\< \_Valid, \_UElements... \> = false\> constexpr **tuple** (tuple\< \_UElements... \> &&\_\_in) noexcept(\_\_nothrow\_constructible\< \_UElements... \>())\
 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... \>())\
 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.
