/* Copyright (C) 2015 Povilas Kanapickas This file is part of cppreference-doc This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. */ #ifndef CPPREFERENCE_UTILITY_H #define CPPREFERENCE_UTILITY_H #if CPPREFERENCE_STDVER>= 2011 #include #endif #include // for size_t #include // for remove_reference namespace std { #if CPPREFERENCE_STDVER>= 2011 // defined in pre C++11 template void swap(T& a, T& b); template void swap(T2(&a)[N], T2(&b)[N]); #endif namespace rel_ops { template bool operator!=(const T& lhs, const T& rhs); template bool operator>(const T& lhs, const T& rhs); template bool operator<=(const T& lhs, const T& rhs); template bool operator>=(const T& lhs, const T& rhs); } // namespace rel_ops #if CPPREFERENCE_STDVER >= 2020 template constexpr T exchange(T& obj, U && new_value); #elif CPPREFERENCE_STDVER >= 2014 template T exchange(T& obj, U && new_value); #endif #if CPPREFERENCE_STDVER >= 2014 template constexpr T&& forward(typename std::remove_reference::type& t); template constexpr T&& forward(typename std::remove_reference::type&& t); #elif CPPREFERENCE_STDVER >= 2011 template T&& forward(typename std::remove_reference::type& t); template T&& forward(typename std::remove_reference::type&& t); #endif #if CPPREFERENCE_STDVER >= 2014 template constexpr T&& move(T&& t); // SIMPLIFIED: return type #elif CPPREFERENCE_STDVER >= 2011 template T&& move(T&& t); // SIMPLIFIED: return type #endif #if CPPREFERENCE_STDVER >= 2014 template constexpr T&& move_if_noexcept(T&& t); // SIMPLIFIED: return type #elif CPPREFERENCE_STDVER >= 2011 template T&& move_if_noexcept(T&& t); // SIMPLIFIED: return type #endif #if CPPREFERENCE_STDVER >= 2011 template T declval(); // SIMPLIFIED: return type #endif #if CPPREFERENCE_STDVER >= 2011 struct piecewise_construct_t { }; constexpr piecewise_construct_t piecewise_construct; #endif #if CPPREFERENCE_STDVER >= 2017 struct in_place_t {}; inline constexpr in_place_t in_place; template struct in_place_type_t{}; template inline constexpr in_place_type_t in_place_type; template struct in_place_index_t; template inline constexpr in_place_index_t in_place_index; #endif template class tuple; template < class T1, class T2 > struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; #if CPPREFERENCE_STDVER >= 2011 constexpr pair(); #else pair(); #endif #if CPPREFERENCE_STDVER >= 2014 constexpr pair(const T1& x, const T2& y); template constexpr pair(const pair& p); constexpr pair(const pair& p); #else pair(const T1& x, const T2& y); template pair(const pair& p); pair(const pair& p); #endif #if CPPREFERENCE_STDVER >= 2014 template constexpr pair(U1&& x, U2&& y); template constexpr pair(pair&& p); constexpr pair(pair&& p); #elif CPPREFERENCE_STDVER >= 2011 template pair(U1&& x, U2&& y); template pair(pair&& p); pair(pair&& p); #endif #if CPPREFERENCE_STDVER >= 2020 template constexpr pair(std::piecewise_construct_t, std::tuple first_args, std::tuple second_args); #elif CPPREFERENCE_STDVER >= 2011 template pair(std::piecewise_construct_t, std::tuple first_args, std::tuple second_args); #endif pair& operator=(const pair& other); template pair& operator=(const pair& other); #if CPPREFERENCE_STDVER>= 2011 pair& operator=(pair&& other); template pair& operator=(pair&& other); #endif void swap(pair& other); }; #if CPPREFERENCE_STDVER >= 2014 template constexpr bool operator==(const pair& lhs, const pair& rhs); template constexpr bool operator!=(const pair& lhs, const pair& rhs); template constexpr bool operator<(const pair& lhs, const pair& rhs); template constexpr bool operator<=(const pair& lhs, const pair& rhs); template constexpr bool operator>(const pair& lhs, const pair& rhs); template constexpr bool operator>=(const pair& lhs, const pair& rhs); #else template bool operator==(const pair& lhs, const pair& rhs); template bool operator!=(const pair& lhs, const pair& rhs); template bool operator<(const pair& lhs, const pair& rhs); template bool operator<=(const pair& lhs, const pair& rhs); template bool operator>(const pair& lhs, const pair& rhs); template bool operator>=(const pair& lhs, const pair& rhs); #endif #if CPPREFERENCE_STDVER >= 2014 template constexpr std::pair make_pair(T1&& t, T2&& u); #elif CPPREFERENCE_STDVER >= 2011 template std::pair make_pair(T1&& t, T2&& u); #else template std::pair make_pair(T1 t, T2 u); #endif template void swap(pair& lhs, pair& rhs); #if CPPREFERENCE_STDVER>= 2011 template class tuple_element; template typename tuple_element>::type& get(pair& p); // SIMPLIFIED: additional overloads omitted #endif #if CPPREFERENCE_STDVER >= 2014 template class tuple_size; template class tuple_size > : public std::integral_constant { }; #endif } // namespace std #endif // CPPREFERENCE_UTILITY_H