/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once namespace base { template struct custom_is_fast_copy_type : public std::false_type { }; // To make your own type a fast copy type just write: // template <> // struct base::custom_is_fast_copy_type : public std::true_type { // }; namespace internal { template struct type_list_contains; template struct type_list_contains : public std::false_type { }; template struct type_list_contains : public std::integral_constant::value || type_list_contains::value> { }; template using is_std_unsigned_int = type_list_contains; template using is_std_signed_int = type_list_contains; template using is_std_integral = std::integral_constant::value || is_std_signed_int::value || type_list_contains::value>; template using is_std_float = type_list_contains; template using is_std_arith = std::integral_constant::value || is_std_float::value>; template using is_std_fundamental = std::integral_constant::value || std::is_same::value>; template struct is_pointer : public std::false_type { }; template struct is_pointer : public std::true_type { }; template struct is_member_pointer : public std::false_type { }; template struct is_member_pointer : public std::true_type { }; template using is_fast_copy_type = std::integral_constant::value || is_pointer::value || is_member_pointer::value || custom_is_fast_copy_type::value>; template struct add_const_reference { using type = const T &; }; template <> struct add_const_reference { using type = void; }; template using add_const_reference_t = typename add_const_reference::type; template struct remove_pointer { using type = T; }; template struct remove_pointer { using type = T; }; template using remove_pointer_t = typename remove_pointer::type; } // namespace internal template struct type_traits { using is_std_unsigned_int = internal::is_std_unsigned_int; using is_std_signed_int = internal::is_std_signed_int; using is_std_integral = internal::is_std_integral; using is_std_float = internal::is_std_float; using is_std_arith = internal::is_std_arith; using is_std_fundamental = internal::is_std_fundamental; using is_pointer = internal::is_pointer; using is_member_pointer = internal::is_member_pointer; using is_fast_copy_type = internal::is_fast_copy_type; using parameter_type = std::conditional_t>; using pointed_type = internal::remove_pointer_t; }; template using parameter_type = typename type_traits::parameter_type; } // namespace base