/* Zeta API - Z/functions/casting.hpp ______ ______________ ___ |__ / | ___|___ ___|/ \ / /__| __| | | / - \ /______|_____| |__| /__/ \__\ Copyright (C) 2006-2024 Manuel Sainz de Baranda y Goñi. Released under the terms of the GNU Lesser General Public License v3. */ #ifndef Z_functions_casting_HPP #define Z_functions_casting_HPP #include #if Z_DIALECT_HAS(CPP11, RVALUE_REFERENCE) # define Z_HAS_forwardable 1 # define Z_HAS_movable 1 namespace Zeta { template static Z_CT(CPP11) t &&forwardable(typename Type::remove_reference &what) Z_NOTHROW {return static_cast(what);} template static Z_CT(CPP11) t &&forwardable(typename Type::remove_reference &&what) Z_NOTHROW {return static_cast(what);} template static Z_CT(CPP11) typename Type::remove_reference &&movable(t &&what) Z_NOTHROW {return static_cast::remove_reference &&>(what);} } # if Z_HAS_MEMBER(Type, is_copy_constructible) && \ Z_HAS_MEMBER(Type, is_nothrow_move_constructible) # include # define Z_HAS_movable_if_nothrow 1 namespace Zeta { // TODO: Revisar template static Z_CT(CPP11) typename TernaryType< Type::is_copy_constructible && !Type::is_nothrow_move_constructible, const t&, t&& >::type movable_if_nothrow(t &what) Z_NOTHROW {return movable(what);} } # endif #endif #endif // Z_functions_casting_HPP