diff options
author | Vas Crabb <vas@vastheman.com> | 2018-06-01 13:07:01 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2018-06-01 13:07:01 +1000 |
commit | d96189dfc9b49a6031d24000d31b9479a73c4e9e (patch) | |
tree | 1eb14c95fef883a52a59bf24b87fb3d453b6315d | |
parent | aebae021bf038e4eb6bf8249e4c42d650efb2891 (diff) |
C++14 has one of these in the standard library (nw)
-rw-r--r-- | src/emu/devfind.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/emu/devfind.h b/src/emu/devfind.h index e564f0beb1d..91c6b8414d3 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -38,20 +38,15 @@ template <typename T, unsigned Count> class object_array_finder { private: - template <unsigned... V> struct indices { }; - template <unsigned C, unsigned... V> struct range : public range<C - 1, C - 1, V...> { }; - template <unsigned... V> struct range<0U, V...> { typedef indices<V...> type; }; - template <unsigned C> using index_range = typename range<C>::type; - template <typename F, typename... Param, unsigned... V> - object_array_finder(device_t &base, F const &fmt, unsigned start, indices<V...>, Param const &... arg) + object_array_finder(device_t &base, F const &fmt, unsigned start, std::integer_sequence<unsigned, V...>, Param const &... arg) : m_tag{ util::string_format(fmt, start + V)... } , m_array{ { base, m_tag[V].c_str(), arg... }... } { } template <typename... Param, unsigned... V> - object_array_finder(device_t &base, std::array<char const *, Count> const &tags, indices<V...>, Param const &... arg) + object_array_finder(device_t &base, std::array<char const *, Count> const &tags, std::integer_sequence<unsigned, V...>, Param const &... arg) : m_array{ { base, tags[V], arg... }... } { } @@ -110,7 +105,7 @@ public: /// \sa util::string_format template <typename F, typename... Param> object_array_finder(device_t &base, F const &fmt, unsigned start, Param const &... arg) - : object_array_finder(base, fmt, start, index_range<Count>(), arg...) + : object_array_finder(base, fmt, start, std::make_integer_sequence<unsigned, Count>(), arg...) { } @@ -126,7 +121,7 @@ public: /// all elements. template <typename... Param> object_array_finder(device_t &base, std::array<char const *, Count> const &tags, Param const &... arg) - : object_array_finder(base, tags, index_range<Count>(), arg...) + : object_array_finder(base, tags, std::make_integer_sequence<unsigned, Count>(), arg...) { } |