Files
fennec/include/fennec/lang/numeric_transforms.h

86 lines
3.2 KiB
C++

// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program 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 License for more details.
//
// You should have received a copy of the GNU General License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file numeric_transforms.h
/// \brief modify numeric types at compile time
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
#ifndef FENNEC_LANG_NUMERIC_TRANSFORMS_H
#define FENNEC_LANG_NUMERIC_TRANSFORMS_H
///
/// \page fennec_lang_numeric_transforms Numeric Transforms
///
/// \code #include <fennec/lang/numeric_transforms.h> \endcode
///
/// This header contains various compile-time functions for changing the characteristics of a provided type
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_numeric_transforms">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::make_signed "typename make_signed<TypeT>::type"<br>
/// \ref fennec::make_signed_t "make_signed_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::make_signed
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::make_unsigned "typename make_unsigned<TypeT>::type"<br>
/// \ref fennec::make_unsigned_t "make_unsigned_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::make_unsigned
///
/// </table>
#include <fennec/lang/type_transforms.h>
#include <fennec/lang/detail/__numeric_transforms.h>
namespace fennec
{
///
/// \brief Get the corresponding signed integral type of TypeT
/// \tparam TypeT the integral type to transform
template<typename TypeT> struct make_signed : detail::__make_signed<remove_cv_t<TypeT>> {};
///
/// \brief Shorthand for `typename make_signed<TypeT>::type`
template<typename TypeT> using make_signed_t = typename make_signed<TypeT>::type;
///
/// \brief Get the corresponding unsigned integral type of TypeT
/// \tparam TypeT the integral type to transform
template<typename TypeT> struct make_unsigned : detail::__make_unsigned<remove_cv_t<TypeT>> {};
///
/// \brief Shorthand for `typename make_unsigned<TypeT>::type`
template<typename TypeT> using make_unsigned_t = typename make_unsigned<TypeT>::type;
}
#endif // FENNEC_LANG_NUMERIC_TRANSFORMS_H