diff --git a/src/core/include/megbrain/utils/metahelper_basic.h b/src/core/include/megbrain/utils/metahelper_basic.h index f2a98434..144a4978 100644 --- a/src/core/include/megbrain/utils/metahelper_basic.h +++ b/src/core/include/megbrain/utils/metahelper_basic.h @@ -21,30 +21,11 @@ namespace mgb { -//! like std::index_sequence in C++14 -template -class index_sequence { - public: - static constexpr size_t size() { return sizeof...(Idx); } -}; - namespace metahelper_detail { [[noreturn]] void on_maybe_invalid_val_access(); - template - struct make_index_sequence_impl; - template - struct make_index_sequence_impl, End> { - using type = typename make_index_sequence_impl< - index_sequence, End-1>::type; - }; - template - struct make_index_sequence_impl, 0> { - using type = index_sequence; - }; - template - constexpr T make_from_tuple_impl(Tuple&& t, index_sequence) { + constexpr T make_from_tuple_impl(Tuple&& t, std::index_sequence) { return T(std::get(std::forward(t))...); } @@ -108,18 +89,13 @@ namespace metahelper_detail { } } // namespace metahelper_detail -//! construct index_sequence<0..N-1> -template -using make_index_sequence = -typename metahelper_detail::make_index_sequence_impl, N>::type; - //! construct object T from tuple of arguments template constexpr T make_from_tuple(Tuple&& t) { constexpr std::size_t size = std::tuple_size>::value; return metahelper_detail::make_from_tuple_impl( - std::forward(t), make_index_sequence{}); + std::forward(t), std::make_index_sequence{}); } /*! diff --git a/src/core/include/megbrain/utils/thin/hash_table.h b/src/core/include/megbrain/utils/thin/hash_table.h index e2125364..b6c9427c 100644 --- a/src/core/include/megbrain/utils/thin/hash_table.h +++ b/src/core/include/megbrain/utils/thin/hash_table.h @@ -466,8 +466,8 @@ namespace thin_hash_table { const std::tuple &k, const std::tuple &v) { return do_emplace_picewise(k, v, - make_index_sequence{}, - make_index_sequence{}); + std::make_index_sequence{}, + std::make_index_sequence{}); } template @@ -539,7 +539,8 @@ namespace thin_hash_table { std::pair do_emplace_picewise( const std::tuple &kargs, const std::tuple &vargs, - index_sequence, index_sequence) { + std::index_sequence, + std::index_sequence) { Key key(std::forward(std::get(kargs))...); auto ret = m_impl.insert(make_impl_key(key)); if (ret.second) {