Adaptor(const Adaptor&) = default;
Adaptor& operator=(const Adaptor&) = default;
- Adaptor(Adaptor&& other) /* may throw */
+ Adaptor(Adaptor&& other)
: c_(std::move(other.c_)),
lastCount_(other.lastCount_) {
other.lastCount_ = Node::kElementCount;
void push_back(value_type x) {
if (lastCount_ == Node::kElementCount) {
- c_.emplace_back();
+ c_.push_back(Node());
lastCount_ = 0;
}
c_.back().data()[lastCount_++] = std::move(x);
void connectionAccepted(int fd, const folly::SocketAddress& clientAddr)
noexcept {
- events_.emplace_back(fd, clientAddr);
+ events_.push_back(EventInfo(fd, clientAddr));
if (connectionAcceptedFn_) {
connectionAcceptedFn_(fd, clientAddr);
}
}
void acceptError(const std::exception& ex) noexcept {
- events_.emplace_back(ex.what());
+ events_.push_back(EventInfo(ex.what()));
if (acceptErrorFn_) {
acceptErrorFn_(ex);
}
}
void acceptStarted() noexcept {
- events_.emplace_back(TYPE_START);
+ events_.push_back(EventInfo(TYPE_START));
if (acceptStartedFn_) {
acceptStartedFn_();
}
}
void acceptStopped() noexcept {
- events_.emplace_back(TYPE_STOP);
+ events_.push_back(EventInfo(TYPE_STOP));
if (acceptStoppedFn_) {
acceptStoppedFn_();
bytesWritten = writeUntilFull(fd_);
}
- log.emplace_back(events, bytesRead, bytesWritten);
+ log.push_back(EventRecord(events, bytesRead, bytesWritten));
}
struct EventRecord {
virtual void handlerReady(uint16_t events) noexcept {
assert(events == EventHandler::READ);
ssize_t bytesRead = readFromFD(fd_, readLength_);
- log.emplace_back(events, bytesRead, 0);
+ log.push_back(EventRecord(events, bytesRead, 0));
}
private:
virtual void handlerReady(uint16_t events) noexcept {
assert(events == EventHandler::WRITE);
ssize_t bytesWritten = writeToFD(fd_, writeLength_);
- log.emplace_back(events, 0, bytesWritten);
+ log.push_back(EventRecord(events, 0, bytesWritten));
}
private:
}
virtual void timeoutExpired() noexcept {
- timestamps.emplace_back();
+ timestamps.push_back(TimePoint());
reschedule();
}
}
void timeoutExpired() noexcept override {
- timestamps.emplace_back();
+ timestamps.push_back(TimePoint());
if (fn) {
fn();
}
}
void callbackCanceled() noexcept override {
- canceledTimestamps.emplace_back();
+ canceledTimestamps.push_back(TimePoint());
if (fn) {
fn();
}
{
throwCounter = 1000;
for (int i = 0; i < prepopulate; ++i) {
- vec.emplace_back();
+ vec.push_back(Thrower());
}
}
(TestBasicGuarantee(prepop))( // parens or a mildly vexing parse :(
1,
[&] (folly::small_vector<Thrower,3>& v) {
- v.emplace_back();
+ v.push_back(Thrower());
}
);
3,
[&] (folly::small_vector<Thrower,3>& v) {
std::vector<Thrower> b;
- b.emplace_back();
- b.emplace_back();
- b.emplace_back();
+ b.push_back(Thrower());
+ b.push_back(Thrower());
+ b.push_back(Thrower());
/*
* Apparently if you do the following initializer_list instead
[&] (folly::small_vector<Thrower,3>& v) {
std::vector<Thrower> b;
for (int i = 0; i < 6; ++i) {
- b.emplace_back();
+ b.push_back(Thrower());
}
v.insert(v.begin() + 1, b.begin(), b.end());
std::list<CountCopyCtor> v;
for (int i = 0; i < 20; ++i) {
- v.emplace_back(20 + i);
+ v.push_back(CountCopyCtor(20 + i));
}
a.insert(v.begin(), v.end());
check_invariant(a);
explicit PriorityLifoSemMPMCQueue(uint8_t numPriorities, size_t capacity) {
queues_.reserve(numPriorities);
for (int8_t i = 0; i < numPriorities; i++) {
- queues_.emplace_back(capacity);
+ queues_.push_back(MPMCQueue<T>(capacity));
}
}