summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-21 20:56:04 +1100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-21 20:56:04 +1100
commit24c928786e7d6fb9191aea14e3abcb3ded76f8d8 (patch)
treed543d26ea410a4fb0d476df393f4dca03bf9f475 /src/emu
parenteaf07fffa33296500c4a6d35bf64a9098ca35fc0 (diff)
constexpr, constructor delegation, integer_sequence, oh my! (hopefully fix MSVC build) (nw)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/input.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/emu/input.h b/src/emu/input.h
index 78383e68ae9..dc76a4a0adb 100644
--- a/src/emu/input.h
+++ b/src/emu/input.h
@@ -24,6 +24,7 @@
#include <map>
#include <memory>
#include <string>
+#include <utility>
//**************************************************************************
@@ -433,14 +434,8 @@ class input_seq
{
public:
// construction/destruction
- constexpr input_seq() noexcept
- {
- reset();
- }
- template <typename... T> constexpr input_seq(input_code code_0, T... code_n) noexcept
- {
- set(code_0, code_n...);
- }
+ constexpr input_seq() noexcept : input_seq(std::make_index_sequence<std::tuple_size<decltype(m_code)>::value>()) { }
+ template <typename... T> constexpr input_seq(input_code code_0, T... code_n) noexcept : input_seq(std::make_index_sequence<std::tuple_size<decltype(m_code)>::value - sizeof...(T) - 1>(), code_0, code_n...) { }
constexpr input_seq(const input_seq &rhs) noexcept = default;
// operators
@@ -478,6 +473,10 @@ public:
static const input_seq empty_seq;
private:
+ static constexpr input_code get_end_code(size_t) noexcept { return end_code; }
+
+ template <typename... T, size_t... N> constexpr input_seq(std::integer_sequence<size_t, N...>, T... code) noexcept : m_code({ code..., get_end_code(N)... }) { }
+
template <unsigned N> void set() noexcept
{
std::fill(std::next(m_code.begin(), N), m_code.end(), end_code);