std::experimental::ranges::tagged

From cppreference.com
< cpp‎ | experimental‎ | ranges
 
 
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
 
 
General utilities library
Utility components
Function objects
Metaprogramming and type traits
Tagged pairs and tuples
                          
tagged
tag specifiers
                                      
                          
 
std::experimental::ranges::tagged
 
template< class Base, TagSpecifier... Tags >

    requires sizeof...(Tags) <= std::tuple_size<Base>::value

struct tagged;
(ranges TS)

The class template tagged augments a tuple-like class type Base, which it publicly derives from, with a set of named accessors specified by the tag specifiers Tags.... The tags are applied in order: the i-th tag specifier in Tags... correspond to the i-th element of the tuple.

The tag specifiers in Tags... shall be unique. Otherwise, the behavior is undefined.

It is not possible to delete an instance of tagged through a pointer to any base other than Base.

Member functions

construct a tagged object
(public member function)
assigns a tagged object
(public member function)
swaps the contents of two tagged objects
(public member function)

Named element accessors

For the N-th tag specifier in Tags... whose corresponding element name is name, tagged provides accessors named name as follows:

constexpr decltype(auto) name() &       { return std::get<N>(*this); }
constexpr decltype(auto) name() const & { return std::get<N>(*this); }
constexpr decltype(auto) name() &&      { return std::get<N>(std::move(*this)); }

Non-member functions

specializes swap for tagged objects
(function)

Tuple-like access

obtains the size of a tagged
(class template specialization)
obtains the types of the elements of a tagged
(class template specialization)

See also

specifies that a type is a tag specifier
(concept)
alias template for a tagged std::pair
(alias template)
convenience function for creating a tagged_pair
(function template)
alias template for a tagged std::tuple
(alias template)
convenience function for creating a tagged_tuple
(function template)
tag specifiers for use with ranges::tagged
(class)