MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / emplace

Method emplace

common/unordered_inline_set.h:86–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers 15

read_meta_frameMethod · 0.45
ObjectCacheV2Class · 0.45
insertMethod · 0.45
basic_map_testFunction · 0.45
TESTFunction · 0.45
seek2nodeMethod · 0.45
creatMethod · 0.45
mkdirMethod · 0.45
enter_dirMethod · 0.45
insertNewFileMethod · 0.45
set_quotaMethod · 0.45

Calls

no outgoing calls

Tested by 3

basic_map_testFunction · 0.36
TESTFunction · 0.36