/* Zeta API - Z/traits/control.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_traits_control_HPP #define Z_traits_control_HPP #include #include #include #if Z_DIALECT_HAS(CPP98, SFINAE) # define Z_HAS_TypeIf 1 # if Z_DIALECT_HAS(CPP11, TYPE_ALIAS_TEMPLATE) # define Z_HAS_type_if 1 # endif #endif #if Z_DIALECT_HAS(CPP11, VARIADIC_TEMPLATE) && Z_DIALECT_HAS(CPP11, TYPE_ALIAS_TEMPLATE) # define Z_HAS_select_type 1 #endif namespace Zeta { template struct TernaryType; template struct TernaryType {typedef t type;}; template struct TernaryType {typedef f type;}; # if Z_HAS(TypeIf) template struct TypeIf {}; template struct TypeIf {typedef t type;}; # if Z_HAS(type_if) template using type_if = typename TypeIf::type; # endif # endif } #if Z_DIALECT_HAS(CPP11, VARIADIC_TEMPLATE) namespace Zeta { # if Z_COMPILER_HAS_TRAIT(SELECT_TYPE) template struct SelectType { typedef Z_COMPILER_TRAIT(SELECT_TYPE)(index, t...) type; }; # if Z_HAS(select_type) template using select_type = Z_COMPILER_TRAIT(SELECT_TYPE)(index, t...); # endif # else template struct SelectType { typedef typename SelectType::type type; }; template struct SelectType<0, t0, t...> { typedef t0 type; }; # if Z_HAS(select_type) template using select_type = typename SelectType::type; # endif # endif } #else # include namespace Zeta { template struct SelectType {}; # define Z_z_SPECIALIZATION(type_count, index) \ template \ struct SelectType { \ typedef t##index type; \ }; # define Z_z_SPECIALIZATION_GROUP(type_count) \ Z_CALL_WITH_TOKEN_AND_INDEX_FOR_##type_count(Z_z_SPECIALIZATION, type_count, Z_EMPTY) Z_CALL_WITH_INDEX_FOR_32(Z_z_SPECIALIZATION_GROUP, Z_EMPTY) # undef Z_z_SPECIALIZATION # undef Z_z_SPECIALIZATION_GROUP } #endif #endif // Z_traits_control_HPP