Skip to content

Commit ce97287

Browse files
authored
chore: Allow return of references with template_switch (#5537)
1 parent ff34fc3 commit ce97287

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Core/include/Acts/Utilities/Helpers.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ std::array<value_t, kDIM> toArray(const std::vector<value_t>& vecvals) {
114114
/// that is callable with @c Args
115115
template <template <std::size_t> class Callable, std::size_t N,
116116
std::size_t NMAX, typename... Args>
117-
auto template_switch(std::size_t v, Args&&... args) {
117+
decltype(auto) template_switch(std::size_t v, Args&&... args) {
118118
if (v == N) {
119119
return Callable<N>::invoke(std::forward<Args>(args)...);
120120
}
@@ -141,7 +141,8 @@ auto template_switch(std::size_t v, Args&&... args) {
141141
/// @param args Additional arguments passed to @p func
142142
/// @return The result of calling the dispatched lambda function
143143
template <std::size_t N, std::size_t NMAX, typename Lambda, typename... Args>
144-
auto template_switch_lambda(std::size_t v, Lambda&& func, Args&&... args) {
144+
decltype(auto) template_switch_lambda(std::size_t v, Lambda&& func,
145+
Args&&... args) {
145146
if (v == N) {
146147
return func(std::integral_constant<std::size_t, N>{},
147148
std::forward<Args>(args)...);

0 commit comments

Comments
 (0)