mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-03 13:14:42 +01:00
imm: compiler bug: MSVC 19.12 with /permissive- flag doesn't support fold expressions
This commit is contained in:
parent
b34c6616d4
commit
26da149639
2 changed files with 31 additions and 2 deletions
28
src/common/math_util.h
Normal file
28
src/common/math_util.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* 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>
|
||||
constexpr T Sum(T first, Ts ...rest) {
|
||||
if constexpr (sizeof...(rest) == 0) {
|
||||
return first;
|
||||
} else {
|
||||
return first + Sum(std::forward<Ts>(rest)...);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
} // namespace Dynarmic
|
||||
Loading…
Add table
Add a link
Reference in a new issue