// =====================================================================================================================
//  fennec, a free and open source game engine
//  Copyright © 2025 - 2026  Medusa Slockbower
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public 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 Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================

///
/// \file fennec/lang/constants.h
/// \brief \ref fennec_lang_constants
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///

#ifndef FENNEC_LANG_CONSTANTS_H
#define FENNEC_LANG_CONSTANTS_H

#include <fennec/lang/types.h>

///
///
/// \page fennec_lang_constants Constants
///
/// \brief This header is part of the metaprogramming library. It defines structures for constant values,
///        used during compile time.
///
/// \code #include <fennec/lang/constants.h> \endcode
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
/// <tr><th style="vertical-align: top">Syntax
///     <th style="vertical-align: top">Description
/// <tr><td width="50%" style="vertical-align: top"> <br>
///         \ref fennec::integral_constant "integral_constant<IntT, IntT ValueV>::type"<br>
///     <td width="50%" style="vertical-align: top">
///         \copydetails fennec::integral_constant
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
///         \ref fennec::bool_constant "bool_constant<bool ValueV>::type"<br>
///     <td width="50%" style="vertical-align: top">
///         \copydetails fennec::bool_constant
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
///         \ref fennec::bool_constant "bool_constant<bool ValueV>::type"<br>
///     <td width="50%" style="vertical-align: top">
///         \copydetails fennec::bool_constant
///
/// </table>
///

namespace fennec
{

///
/// \brief metaprogramming integral constant
///
/// \details A metaprogramming integral constant
/// \tparam IntT type of the constant
/// \tparam ValueV value of the constant
template<typename IntT, IntT ValueV> struct integral_constant
{
	///
	/// \brief value of the constant
	inline static constexpr IntT value = ValueV;

	///
	/// \brief cast operator to allow for braced initialization
	/// \returns the value of the constant
	constexpr operator IntT() const noexcept { return value; }
};


///
/// \brief metaprogramming boolean constant
///
/// \details
/// \tparam ValueV value of the constant
template<bool ValueV>
struct bool_constant
	: integral_constant<bool_t, ValueV> {};


///
/// \brief metaprogramming true constant
struct true_type
	: bool_constant<true>  {};


///
/// \brief metaprogramming false constant
struct false_type
	: bool_constant<false> {};

}

#endif // FENNEC_LANG_CONSTANTS_H
