| 544 | // this method. |
| 545 | template <typename T, typename VT> |
| 546 | void InsertValueMove(T&& value) { |
| 547 | if (is_inline_) { |
| 548 | Value<VT>* inline_value_data = |
| 549 | reinterpret_cast<Value<VT>*>(value_.inline_value.value_data); |
| 550 | new (inline_value_data) Value<VT>(kInPlace, std::forward<T>(value)); |
| 551 | value_.inline_value.has_value = true; |
| 552 | } else { |
| 553 | auto* moved = static_cast<Value<VT>*>(port::Malloc(sizeof(Value<VT>))); |
| 554 | new (moved) Value<VT>(kInPlace, std::forward<T>(value)); |
| 555 | value_.heap_value = HeapValue(moved); |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | // PRECONDITION: Called on construction or clear() has been called before |
| 560 | // this method. |