! * \brief Create an ArrayObj with the given capacity. * \param n Required capacity * \return Ref-counted ArrayObj requested */
| 119 | * \return Ref-counted ArrayObj requested |
| 120 | */ |
| 121 | static ObjectPtr<ArrayObj> Empty(int64_t n = kInitSize) { |
| 122 | ObjectPtr<ArrayObj> p = make_inplace_array_object<ArrayObj, Any>(n); |
| 123 | p->TVMFFISeqCell::capacity = n; |
| 124 | p->TVMFFISeqCell::size = 0; |
| 125 | p->data = reinterpret_cast<char*>(p.get()) + sizeof(ArrayObj); |
| 126 | p->data_deleter = nullptr; |
| 127 | return p; |
| 128 | } |
| 129 | |
| 130 | /*! |
| 131 | * \brief Inplace-initialize the elements starting idx from [first, last) |