Files
cppdraft_translate/cppdraft/depr/variant.md
2025-10-25 03:02:53 +03:00

2.0 KiB
Raw Blame History

[depr.variant]

Annex D (normative) Compatibility features [depr]

D.16 Variant [depr.variant]

1

#

The header has the following additions:namespace std {template struct variant_size; template struct variant_size; 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>;}

🔗

template<class T> struct variant_size<volatile T>; template<class T> struct variant_size<const volatile T>;

2

#

Let VS denote variant_size of the cv-unqualified type T.

Then specializations of each of the two templates meet the Cpp17UnaryTypeTrait requirements with a base characteristic of integral_constant<size_t, VS::value>.

🔗

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

#

Let VA denote variant_alternative<I, T> of the cv-unqualified type T.

Then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a member typedef type that names the following type:

for the first specialization, add_volatile_t<VA::type>, and

for the second specialization, add_cv_t<VA::type>.