mirror of
https://github.com/holub/mame
synced 2025-06-09 22:33:00 +03:00
constexpr, constructor delegation, integer_sequence, oh my! (hopefully fix MSVC build) (nw)
This commit is contained in:
parent
eaf07fffa3
commit
24c928786e
@ -24,6 +24,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -433,14 +434,8 @@ class input_seq
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
constexpr input_seq() noexcept
|
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...) { }
|
||||||
reset();
|
|
||||||
}
|
|
||||||
template <typename... T> constexpr input_seq(input_code code_0, T... code_n) noexcept
|
|
||||||
{
|
|
||||||
set(code_0, code_n...);
|
|
||||||
}
|
|
||||||
constexpr input_seq(const input_seq &rhs) noexcept = default;
|
constexpr input_seq(const input_seq &rhs) noexcept = default;
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
@ -478,6 +473,10 @@ public:
|
|||||||
static const input_seq empty_seq;
|
static const input_seq empty_seq;
|
||||||
|
|
||||||
private:
|
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
|
template <unsigned N> void set() noexcept
|
||||||
{
|
{
|
||||||
std::fill(std::next(m_code.begin(), N), m_code.end(), end_code);
|
std::fill(std::next(m_code.begin(), N), m_code.end(), end_code);
|
||||||
|
Loading…
Reference in New Issue
Block a user