SysTutorials

Linux Manual Pages › Section 3

stdexperimentalrangescommon_reference(3)

std::experimental::ranges::common_reference - std::experimental::ranges::common_reference

Synopsis

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

Determines the common reference type of the types T…, that is, the type to which all the types in T… can be converted or bound. 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. When given reference types, common_reference attempts to find a reference type to which the supplied reference types can all be bound, but may return a non-reference type if it cannot find such a reference type.

Member types

Name Definition type the common reference type for all T…

Helper types

template< class… T > using common_reference_t = typename common_reference<T…>::type; template< class T, class U, template<class> class TQual, template<class> class UQual > struct basic_common_reference { };

The class template basic_common_reference is a customization point that allows users to influence the result of common_reference for user-defined types (typically proxy references). The primary template is empty.

Specializations

A program may specialize basic_common_reference<T, U, TQual, UQual> on the first two parameters T and U if std::is_same<T, std::decay_t<T>> and std::is_same<U, std::decay_t<U>> are both true and at least one of them depends on a program-defined type. If such a specialization has a member named type, it must be a public and unambiguous member type that names a type to which both TQual<T> and UQual<U> are convertible. Additionally, ranges::basic_common_reference<T, U, TQual, UQual>::type and ranges::basic_common_reference<U, T, UQual, TQual>::type must denote the same type. A program may not specialize basic_common_reference on the third or fourth parameters, nor may it specialize common_reference itself. A program that adds specializations in violation of these rules has undefined behavior.

Notes

 This section is incomplete

Examples

 This section is incomplete  Reason: no example

See also

common_type determines the common type of a group of types                 (class template) (C++11)                 determine the common type of a set of types common_type (class template)                 specifies that two types share a common reference type CommonReference (concept)