! * \brief Insert an element into the given position * \param position An iterator pointing to the insertion point * \param val The element to insert */
| 444 | * \param val The element to insert |
| 445 | */ |
| 446 | void insert(iterator position, const T& val) { |
| 447 | if (data_ == nullptr) { |
| 448 | TVM_FFI_THROW(RuntimeError) << "cannot insert a null array"; |
| 449 | } |
| 450 | int64_t idx = std::distance(begin(), position); |
| 451 | CopyOnWrite(1)->insert(idx, Any(val)); |
| 452 | } |
| 453 | |
| 454 | /*! |
| 455 | * \brief Insert a range of elements into the given position |