8000 Remove emplace hack that was introduced on OSX to support C++17 by ObiWahn · Pull Request #10184 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Remove emplace hack that was introduced on OSX to support C++17 #10184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert "Revert "Remove emplace hack that was introduced for OSX""
This reverts commit 7df9edd.
  • Loading branch information
ObiWahn committed Oct 8, 2019
commit 160b582a5fb97bfc9b795ee9362ed07d4fb39f3f
36 changes: 0 additions & 36 deletions 3rdParty/rocksdb/6.2/utilities/transactions/transaction_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,48 +121,12 @@ Status TransactionBaseImpl::TryLock(ColumnFamilyHandle* column_family,
assume_tracked);
}

#if defined(__APPLE__) && _LIBCPP_STD_VER > 14
// miserable hack to access the container member of std::stack
// this is done because on older xcode stl versions
// std::stack::emplace does not work correctly
// this hack should not be ported to new versions
// please consinder to increase the xcode version
// requirements instead.

template<typename type>
struct access {
inline static type member_pointer;
};

template<typename type, type pointer>
struct create_access : access<type> {
struct assign_pointer {
assign_pointer() { access<type>::member_pointer = pointer; }
};
inline static assign_pointer by_calling_default_ctor;
};


using member_type = autovector<TransactionBaseImpl::SavePoint>;
using container_type = std::stack<TransactionBaseImpl::SavePoint, autovector<TransactionBaseImpl::SavePoint>>;
using private_type = member_type container_type::*;
template struct create_access<private_type, &container_type::c>;
#endif

void TransactionBaseImpl::SetSavePoint() {
if (save_points_ == nullptr) {
save_points_.reset(new std::stack<TransactionBaseImpl::SavePoint, autovector<TransactionBaseImpl::SavePoint>>());
}

#if defined(__APPLE__) && _LIBCPP_STD_VER > 14
((*save_points_).*access<private_type>::member_pointer).emplace_back(
snapshot_, snapshot_needed_, snapshot_notifier_,
num_puts_, num_deletes_, num_merges_);

#else
save_points_->emplace(snapshot_, snapshot_needed_, snapshot_notifier_,
num_puts_, num_deletes_, num_merges_);
#endif
write_batch_.SetSavePoint();
}

Expand Down
0