DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
reverse.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2025 Cody R. Drisko. All rights reserved.
2// Licensed under the MIT License. See the LICENSE file in the project root for more information.
3//
4// Name: reverse.hpp
5// Author: crdrisko
6// Date: 01/07/2021-07:03:42
7// Description: A metafunction for reversing a std::tuple
8
9#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_TUPLES_TUPLEALGORITHMS_REVERSE_HPP
10#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_TUPLES_TUPLEALGORITHMS_REVERSE_HPP
11
12#include <tuple>
13#include <utility>
14
17
18namespace CppUtils::Meta
19{
27 template<typename... Elements>
28 constexpr auto reverse(const std::tuple<Elements...>& tuple)
29 {
30 return select(tuple, Meta::reverse_list_t<std::make_index_sequence<sizeof...(Elements)>>());
31 }
32} // namespace CppUtils::Meta
33
34#endif
Definition frontList.hpp:13
typename reverse_list< List >::type reverse_list_t
Convenience variable template for ease-of-use.
Definition reverseList.hpp:31
constexpr auto reverse(const std::tuple< Elements... > &tuple)
Definition reverse.hpp:28
constexpr auto select(const std::tuple< Elements... > &tuple, std::index_sequence< Indices... >)
Definition select.hpp:27