diff --git a/src/emu/devfind.h b/src/emu/devfind.h index 5b48ad04862..d4a7a7defa9 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -503,46 +503,52 @@ public: // ======================> shared_ptr_array_finder // shared pointer array finder template -template -class shared_ptr_array_finder +template +class shared_ptr_array_finder : public array_finder_base, Count> { - typedef shared_ptr_finder<_PointerType, _Required> shared_ptr_type; - public: - // construction/destruction - shared_ptr_array_finder(device_t &base, const char *basetag, UINT8 width = sizeof(_PointerType) * 8) + template + shared_ptr_array_finder(device_t &base, F const &fmt, unsigned start) + : array_finder_base, Count>(base, fmt, start) { - for (int index = 0; index < _Count; index++) - { - m_tag[index] = string_format("%s.%d", basetag, index); - m_array[index] = std::make_unique(base, m_tag[index].c_str(), width); - } } - // array accessors - const shared_ptr_type &operator[](int index) const { assert(index < _Count); return *m_array[index]; } - shared_ptr_type &operator[](int index) { assert(index < _Count); return *m_array[index]; } + shared_ptr_array_finder(device_t &base, const char *basetag) + : array_finder_base, Count>(base, basetag) + { + } -protected: - // internal state - std::unique_ptr m_array[_Count]; - std::string m_tag[_Count]; + shared_ptr_array_finder(device_t &base, char const *const tags[]) + : array_finder_base, Count>(base, tags) + { + } + + shared_ptr_array_finder(device_t &base, std::array const &tags) + : array_finder_base, Count>(base, tags) + { + } }; // optional shared pointer array finder -template -class optional_shared_ptr_array : public shared_ptr_array_finder<_PointerType, _Count, false> +template +class optional_shared_ptr_array : public shared_ptr_array_finder { public: - optional_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, false>(base, tag, width) { } + template optional_shared_ptr_array(device_t &base, F const &fmt, unsigned start) : shared_ptr_array_finder(base, fmt, start) { } + optional_shared_ptr_array(device_t &base, char const *basetag) : shared_ptr_array_finder(base, basetag) { } + optional_shared_ptr_array(device_t &base, char const *const tags[]) : shared_ptr_array_finder(base, tags) { } + optional_shared_ptr_array(device_t &base, std::array const &tags) : shared_ptr_array_finder(base, tags) { } }; // required shared pointer array finder -template -class required_shared_ptr_array : public shared_ptr_array_finder<_PointerType, _Count, true> +template +class required_shared_ptr_array : public shared_ptr_array_finder { public: - required_shared_ptr_array(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8) : shared_ptr_array_finder<_PointerType, _Count, true>(base, tag, width) { } + template required_shared_ptr_array(device_t &base, F const &fmt, unsigned start) : shared_ptr_array_finder(base, fmt, start) { } + required_shared_ptr_array(device_t &base, char const *basetag) : shared_ptr_array_finder(base, basetag) { } + required_shared_ptr_array(device_t &base, char const *const tags[]) : shared_ptr_array_finder(base, tags) { } + required_shared_ptr_array(device_t &base, std::array const &tags) : shared_ptr_array_finder(base, tags) { } };