/* * SPDX-License-Identifier: MIT * Copyright (c) 2019 winterscar * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifdef _NONSTD_FUNCTIONAL_HHP #define _NONSTD_FUNCTIONAL_HHP #include // extern void * operator new(size_t size, void * ptr); void* operator new(size_t size, void* ptr) { return ptr; } namespace nonstd { template struct tag { using type = T; }; template using type_t = typename Tag::type; using size_t = decltype(sizeof(int)); // move template T&& move(T& t) { return static_cast(t); } // forward template struct remove_reference : tag {}; template struct remove_reference : tag {}; template using remove_reference_t = type_t>; template T&& forward(remove_reference_t& t) { return static_cast(t); } template T&& forward(remove_reference_t&& t) { return static_cast(t); } // decay template struct remove_const : tag {}; template struct remove_const : tag {}; template struct remove_volatile : tag {}; template struct remove_volatile : tag {}; template struct remove_cv : remove_const>> {}; template struct decay3 : remove_cv {}; template struct decay3 : tag {}; template struct decay2 : decay3 {}; template struct decay2 : tag {}; template struct decay : decay2> {}; template using decay_t = type_t>; // is_convertible template T declval(); // no implementation template struct integral_constant { static constexpr T value = t; constexpr integral_constant(){}; constexpr operator T() const { return value; } constexpr T operator()() const { return value; } }; template using bool_t = integral_constant; using true_type = bool_t; using false_type = bool_t; template struct voider : tag {}; template using void_t = type_t>; namespace details { template