GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::ranges::common_type(3) C++ Standard Libary std::experimental::ranges::common_type(3)

std::experimental::ranges::common_type - std::experimental::ranges::common_type


Defined in header <experimental/ranges/type_traits>
template< class... T > (ranges TS)
struct common_type;


Determines the common type among all types T..., that is the type all T... can be
implicitly converted to. If such a type exists (as determined according to the rules
below), the member type names that type. Otherwise, there is no member type. The
behavior is undefined if any of the types in T... is an incomplete type other than
(possibly cv-qualified) void.


* If sizeof...(T) is zero, there is no member type.
* If sizeof...(T) is one (i.e., T... contains only one type T0), the member type
names the same type as std::decay_t<T0>.
* If sizeof...(T) is two (i.e., T... contains exactly two types T1 and T2),


* If applying std::decay to at least one of T1 and T2 produces a
different type, the member type names the same type as
ranges::common_type_t<std::decay_t<T1>, std::decay_t<T2>>, if it
exists; if not, there is no member type.
* Otherwise, (and unless there is a user specialization for
ranges::common_type<T1, T2>), if std::common_type_t<T1, T2> is
well-formed, then the member type denotes that type;
* Otherwise, the member type denotes the type std::decay_t<decltype(false
? std::declval<const T1&>() : std::declval<const T2&>())>, if that
conditional expression is well-formed; if not, there is no member type.


* If sizeof...(T) is greater than two (i.e., T... consists of the types T1, T2,
R...), then if ranges::common_type_t<T1, T2> exists, the member type denotes
ranges::common_type_t<ranges::common_type_t<T1, T2>, R...> if such a type
exists. In all other cases, there is no member type.


Name Definition
type the common type for all T...


template< class... T >
using common_type_t = typename common_type<T...>::type;


Users may specialize common_type for types T1 and T2 if


* At least one of T1 and T2 depends on a user-defined type, and
* std::decay is an identity transformation for both T1 and T2.


If such a specialization has a member named type, it must be a public and
unambiguous member type that names a cv-unqualified non-reference type to which both
T1 and T2 are explicitly convertible. Additionally, ranges::common_type_t<T1, T2>
and ranges::common_type_t<T2, T1> must denote the same type.


A program that adds common_type specializations in violation of these rules has
undefined behavior.


For arithmetic types not subject to promotion, the common type may be viewed as the
type of the (possibly mixed-mode) arithmetic expression such as T0() + T1() + ... +
Tn().


This section is incomplete
Reason: no example


common_type determines the common type of a group of types
(C++11) (class template)
common_reference determine the common reference type of a set of types
(class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.