Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void M_relocate(T* newB) {
- relocate_move(newB, impl_.b_, impl_.e_);
- relocate_done(newB, impl_.b_, impl_.e_);
- }
- void relocate_move_or_memcpy(T* dest, T* first, T* last, std::true_type) {
- if (first != nullptr) {
- std::memcpy((void*)dest, (void*)first, (last - first) * sizeof(T));
- }
- }
- void relocate_done(T* /*dest*/, T* first, T* last) noexcept {
- if (folly::IsRelocatable<T>::value && usingStdAllocator) {
- // used memcpy; data has been relocated, do not call destructor
- } else {
- D_destroy_range_a(first, last);
- }
- }
- ^^^^^^^^^^^^^ If `T = std::unique_pointer<int>`, how will the original objects know to not deallocate the `int`s when they go out of scope?
- (Code taken from: https://github.com/facebook/folly/blob/5445a6d9761fb511cbd0add6e31b84908b387948/folly/FBVector.h#L658)
Advertisement
Add Comment
Please, Sign In to add comment