// =====================================================================================================================
//  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 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/>.
// =====================================================================================================================

#ifndef FENNEC_CONTAINERS_DETAIL_TUPLE_H
#define FENNEC_CONTAINERS_DETAIL_TUPLE_H
#include <fennec/lang/const_sequences.h>
#include <fennec/lang/utility.h>

namespace fennec::detail
{


template <std::size_t I, typename T>
struct _tuple_leaf
{
    template <typename ArgT>
    _tuple_leaf(ArgT&& arg) : value(fennec::forward<ArgT>(arg)) {}

    ~_tuple_leaf() = default;

    T value;
};

template <typename, typename...>
struct _tuple;

template <size_t...IndicesV, typename...TypesT>
struct _tuple<const_index_sequence<IndicesV...>, TypesT...> : _tuple_leaf<IndicesV, TypesT>...
{
    template <typename...ArgsT>
    _tuple(ArgsT&&... args) : _tuple_leaf<IndicesV, TypesT>(fennec::forward<ArgsT>(args))... {}

    ~_tuple() = default;
};

}

#endif // FENNEC_CONTAINERS_DETAIL_TUPLE_H
