| 84 | } |
| 85 | template<typename...Xs> |
| 86 | void emplace(size_t i, Xs&&...xs) { |
| 87 | assert(i < _capacity); |
| 88 | if (!get_bit(i)) { |
| 89 | // _ptr[i].T(std::forward<Xs>(xs)...); // these 2 forms should be almost equal, except |
| 90 | new (_ptr + i) T(std::forward<Xs>(xs)...); // this is compatible with basic types, like int, etc. |
| 91 | set_bit(i); |
| 92 | _size++; |
| 93 | } else { |
| 94 | _ptr[i].~T(); |
| 95 | new (_ptr + i) T(std::forward<Xs>(xs)...); |
| 96 | } |
| 97 | } |
| 98 | const T* get(size_t i) const noexcept { return _get(i); } |
| 99 | T* get(size_t i) noexcept { return (T*)_get(i); } |
| 100 | void erase(size_t i) { |
no outgoing calls