Files
2025-10-25 03:02:53 +03:00

52 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[depr.variant]
# Annex D (normative) Compatibility features [[depr]](./#depr)
## D.16 Variant [depr.variant]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L592)
The header [<variant>](variant.syn#header:%3cvariant%3e "22.6.2Header <variant> synopsis[variant.syn]") has the following additions:namespace std {template<class T> struct variant_size<volatile T>; template<class T> struct variant_size<const volatile T>; template<size_t I, class T> struct variant_alternative<I, volatile T>; template<size_t I, class T> struct variant_alternative<I, const volatile T>;}
[🔗](#itemdecl:1)
`template<class T> struct variant_size<volatile T>;
template<class T> struct variant_size<const volatile T>;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L610)
Let VS denote variant_size<T> of the cv-unqualified type T[.](#2.sentence-1)
Then specializations of each of the two templates meet
the [*Cpp17UnaryTypeTrait*](meta.rqmts#:Cpp17UnaryTypeTrait "21.3.2Requirements[meta.rqmts]") requirements
with a base characteristic of integral_constant<size_t, VS::value>[.](#2.sentence-2)
[🔗](#itemdecl:2)
`template<size_t I, class T> struct variant_alternative<I, volatile T>;
template<size_t I, class T> struct variant_alternative<I, const volatile T>;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L624)
Let VA denote variant_alternative<I, T> of the cv-unqualified type T[.](#3.sentence-1)
Then specializations of each of the two templates meet
the [*Cpp17TransformationTrait*](meta.rqmts#:Cpp17TransformationTrait "21.3.2Requirements[meta.rqmts]") requirements
with a member typedef type that names the following type:
- [(3.1)](#3.1)
for the first specialization, add_volatile_t<VA::type>, and
- [(3.2)](#3.2)
for the second specialization, add_cv_t<VA::type>[.](#3.sentence-2)