2018-01-12 16:22:38 +00:00
|
|
|
/* This file is part of the dynarmic project.
|
|
|
|
* Copyright (c) 2018 MerryMage
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
|
|
|
* General Public License version 2 or any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace Dynarmic {
|
|
|
|
namespace Common {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is a workaround for a bug in MSVC 19.12 where fold expressions
|
|
|
|
* do not work when the /permissive- flag is enabled.
|
|
|
|
*/
|
|
|
|
template<typename T, typename... Ts>
|
2018-04-08 10:37:11 +01:00
|
|
|
constexpr T Sum(T first, Ts&&... rest) {
|
2018-01-12 16:22:38 +00:00
|
|
|
if constexpr (sizeof...(rest) == 0) {
|
|
|
|
return first;
|
|
|
|
} else {
|
|
|
|
return first + Sum(std::forward<Ts>(rest)...);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Common
|
|
|
|
} // namespace Dynarmic
|