! * \brief Move data from one index to another index * \param src_idx * \param dst_idx */
| 798 | * \param dst_idx |
| 799 | */ |
| 800 | void Move(int src_idx, int dst_idx) { |
| 801 | if (is_enough_) { |
| 802 | std::swap(pool_[src_idx], pool_[dst_idx]); |
| 803 | return; |
| 804 | } |
| 805 | if (mapper_[src_idx] < 0) { |
| 806 | return; |
| 807 | } |
| 808 | // get slot of src idx |
| 809 | int slot = mapper_[src_idx]; |
| 810 | // reset src_idx |
| 811 | mapper_[src_idx] = -1; |
| 812 | |
| 813 | // move to dst idx |
| 814 | mapper_[dst_idx] = slot; |
| 815 | last_used_time_[slot] = ++cur_time_; |
| 816 | inverse_mapper_[slot] = dst_idx; |
| 817 | } |
| 818 | |
| 819 | private: |
| 820 | std::vector<std::unique_ptr<FeatureHistogram[]>> pool_; |
no outgoing calls
no test coverage detected