/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * 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 2 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 . */ #ifndef Tuples_h__ #define Tuples_h__ #include namespace Trinity { template struct has_type; template struct has_type> : std::disjunction...> { }; template constexpr bool has_type_v = has_type::value; template struct is_tuple : std::false_type { }; template struct is_tuple> : std::true_type { }; template constexpr bool is_tuple_v = is_tuple::value; namespace Impl { template T* new_from_tuple(Tuple&& args, std::index_sequence) { return new T(std::get(std::forward(args))...); } } template [[nodiscard]] T* new_from_tuple(Tuple&& args) { return Impl::new_from_tuple(std::forward(args), std::make_index_sequence>>{}); } } #endif // Tuples_h__