/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #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