std::vector<Subprocess::ChildPipe> Subprocess::takeOwnershipOfPipes() {
std::vector<Subprocess::ChildPipe> pipes;
for (auto& p : pipes_) {
- pipes.emplace_back(ChildPipe{p.childFd, std::move(p.pipe)});
+ pipes.emplace_back(p.childFd, std::move(p.pipe));
}
pipes_.clear();
return pipes;
* No, you may NOT call this from a communicate() callback.
*/
struct ChildPipe {
+ ChildPipe(int fd, folly::File&& ppe) : childFd(fd), pipe(std::move(ppe)) {}
int childFd;
folly::File pipe; // Owns the parent FD
};
for (const auto& pair : patternProperties->items()) {
if (pair.first.isString()) {
patternPropertyValidators_.emplace_back(
- make_pair(boost::regex(pair.first.getString().toStdString()),
- SchemaValidator::make(context, pair.second)));
+ boost::regex(pair.first.getString().toStdString()),
+ SchemaValidator::make(context, pair.second));
}
}
}
propertyDep_.emplace_back(std::move(p));
}
if (pair.second.isObject()) {
- schemaDep_.emplace_back(
- make_pair(pair.first.getString(),
- SchemaValidator::make(context, pair.second)));
+ schemaDep_.emplace_back(pair.first.getString(),
+ SchemaValidator::make(context, pair.second));
}
}
}
}
void timedSchedule(std::function<void()> func, TimePoint time) override {
- scheduledFuncs_.push_back({time, std::move(func)});
+ scheduledFuncs_.emplace_back(time, std::move(func));
}
private:
std::vector<std::pair<size_t, int>> results;
forEach(funcs.begin(), funcs.end(),
[&results](size_t id, int result) {
- results.push_back(std::make_pair(id, result));
+ results.emplace_back(id, result);
});
EXPECT_EQ(3, results.size());
EXPECT_TRUE(pendingFibers.empty());
int m = std::min(n, 1000);
std::uniform_int_distribution<uint32_t> u(1, m);
int cut = u(random);
- out.push_back(std::make_pair(key, cut));
+ out.emplace_back(key, cut);
n -= cut;
}
}
auto c = ++ctx->completed;
if (c <= n) {
assert(ctx->v.size() < n);
- ctx->v.push_back(std::make_pair(i, std::move(t)));
+ ctx->v.emplace_back(i, std::move(t));
if (c == n) {
ctx->p.setTry(Try<V>(std::move(ctx->v)));
}
};
struct NextProtocolsItem {
+ NextProtocolsItem(int wt, const std::list<std::string>& ptcls):
+ weight(wt), protocols(ptcls) {}
int weight;
std::list<std::string> protocols;
};
};
void runInThreadTestFunc(RunInThreadArg* arg) {
- arg->data->values.push_back(make_pair(arg->thread, arg->value));
+ arg->data->values.emplace_back(arg->thread, arg->value);
RunInThreadData* data = arg->data;
delete arg;
futexLock.lock();
if (data == expected) {
auto& queue = futexQueues[this];
- queue.push_back(std::make_pair(waitMask, &awoken));
+ queue.emplace_back(waitMask, &awoken);
auto ours = queue.end();
ours--;
while (!awoken) {
EXPECT_EQ(*newObject.keys().begin(), newObject.items().begin()->first);
EXPECT_EQ(*newObject.values().begin(), newObject.items().begin()->second);
std::vector<std::pair<folly::fbstring, dynamic>> found;
- found.push_back(std::make_pair(
- newObject.keys().begin()->asString(),
- *newObject.values().begin()));
+ found.emplace_back(newObject.keys().begin()->asString(),
+ *newObject.values().begin());
EXPECT_EQ(*boost::next(newObject.keys().begin()),
boost::next(newObject.items().begin())->first);
EXPECT_EQ(*boost::next(newObject.values().begin()),
boost::next(newObject.items().begin())->second);
- found.push_back(std::make_pair(
- boost::next(newObject.keys().begin())->asString(),
- *boost::next(newObject.values().begin())));
+ found.emplace_back(boost::next(newObject.keys().begin())->asString(),
+ *boost::next(newObject.values().begin()));
std::sort(found.begin(), found.end());
~SSLContextConfig() {}
struct CertificateInfo {
+ CertificateInfo(const std::string& crtPath,
+ const std::string& kyPath,
+ const std::string& passwdPath)
+ : certPath(crtPath), keyPath(kyPath), passwordPath(passwdPath) {}
std::string certPath;
std::string keyPath;
std::string passwordPath;
void addCertificate(const std::string& certPath,
const std::string& keyPath,
const std::string& passwordPath) {
- certificates.emplace_back(CertificateInfo{certPath, keyPath, passwordPath});
+ certificates.emplace_back(certPath, keyPath, passwordPath);
}
/**
*/
void setNextProtocols(const std::list<std::string>& inNextProtocols) {
nextProtocols.clear();
- nextProtocols.push_back({1, inNextProtocols});
+ nextProtocols.emplace_back(1, inNextProtocols);
}
typedef std::function<bool(char const* server_name)> SNINoMatchFn;
SSLUtil::hexlify(sessionId);
std::unique_ptr<DelayedDestruction::DestructorGuard> dg(
new DelayedDestruction::DestructorGuard(sslSocket));
- pit->second.waiters.push_back(
- std::make_pair(sslSocket, std::move(dg)));
+ pit->second.waiters.emplace_back(sslSocket, std::move(dg));
*copyflag = SSL_SESSION_CB_WOULD_BLOCK;
return nullptr;
}