DryChem
1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
apply_n.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: apply_n.hpp
5
// Author: crdrisko
6
// Date: 11/21/2020-10:35:11
7
// Description: An algorithm, based off std::apply, that only applies a function to the first N elements of a tuple
8
9
#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_TUPLES_TUPLEALGORITHMS_APPLY_N_HPP
10
#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TYPES_TUPLES_TUPLEALGORITHMS_APPLY_N_HPP
11
12
#include <cstddef>
13
#include <tuple>
14
#include <utility>
15
16
#include "
common-utils/meta/types/tuples/tupleAlgorithms/select.hpp
"
17
18
namespace
CppUtils::Meta
19
{
30
template
<std::
size_t
N,
typename
F,
typename
Tuple>
31
constexpr
decltype
(
auto
)
apply_n
(F&& f, Tuple&& tuple)
32
{
33
return
std::apply(std::forward<F>(f),
select
(std::forward<Tuple>(tuple), std::make_index_sequence<N> {}));
34
}
35
}
// namespace CppUtils::Meta
36
37
#endif
CppUtils::Meta
Definition
frontList.hpp:13
CppUtils::Meta::apply_n
constexpr decltype(auto) apply_n(F &&f, Tuple &&tuple)
Definition
apply_n.hpp:31
CppUtils::Meta::select
constexpr auto select(const std::tuple< Elements... > &tuple, std::index_sequence< Indices... >)
Definition
select.hpp:27
select.hpp
common-utilities
include
common-utils
meta
types
tuples
tupleAlgorithms
apply_n.hpp
Generated on Thu Feb 13 2025 11:55:13 for DryChem by
1.13.2