Commit 455116f7 authored by TJ Yin's avatar TJ Yin Committed by Facebook Github Bot

replace more folly::Optional::reset by clear inside template

Reviewed By: vitaut

Differential Revision: D20098574

fbshipit-source-id: 409c3c1e7716a38f253fa3d0d8afe615139426cc
parent 4af06cab
......@@ -118,7 +118,7 @@ class Optional {
std::is_nothrow_move_constructible<Value>::value) {
if (src.hasValue()) {
construct(std::move(src.value()));
src.clear();
src.reset();
}
}
......@@ -157,16 +157,16 @@ class Optional {
}
void assign(const None&) {
clear();
reset();
}
void assign(Optional&& src) {
if (this != &src) {
if (src.hasValue()) {
assign(std::move(src.value()));
src.clear();
src.reset();
} else {
clear();
reset();
}
}
}
......@@ -175,7 +175,7 @@ class Optional {
if (src.hasValue()) {
assign(src.value());
} else {
clear();
reset();
}
}
......@@ -220,7 +220,7 @@ class Optional {
template <class... Args>
Value& emplace(Args&&... args) {
clear();
reset();
construct(std::forward<Args>(args)...);
return value();
}
......@@ -230,7 +230,7 @@ class Optional {
std::is_constructible<Value, std::initializer_list<U>&, Args&&...>::value,
Value&>::type
emplace(std::initializer_list<U> ilist, Args&&... args) {
clear();
reset();
construct(ilist, std::forward<Args>(args)...);
return value();
}
......
......@@ -107,7 +107,7 @@ void runKeyExtractCases(
{
std::pair<Tracked<0> const, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, p);
// fresh key, value_type const& ->
......@@ -121,7 +121,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0> const, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, std::move(p));
// fresh key, value_type&& ->
......@@ -135,7 +135,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0>, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, p);
// fresh key, pair<key_type,mapped_type> const& ->
......@@ -149,7 +149,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0>, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, std::move(p));
// fresh key, pair<key_type,mapped_type>&& ->
......@@ -163,7 +163,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<2>, Tracked<3>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, p);
// fresh key, convertible const& ->
......@@ -198,7 +198,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<2>, Tracked<3>> p{0, 0};
sink.clear();
sink.reset();
resetTracking();
func(sinkFunc, std::move(p));
// fresh key, convertible&& ->
......@@ -215,7 +215,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0> const, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, p);
......@@ -227,7 +227,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0> const, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, std::move(p));
......@@ -239,7 +239,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0>, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, p);
......@@ -251,7 +251,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<0>, Tracked<1>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, std::move(p));
......@@ -263,7 +263,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<2>, Tracked<3>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, p);
......@@ -281,7 +281,7 @@ void runKeyExtractCases(
}
{
std::pair<Tracked<2>, Tracked<3>> p{0, 0};
sink.clear();
sink.reset();
sink.emplace(0, 0);
resetTracking();
func(sinkFunc, std::move(p));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment