Commit 96dd41a3 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

Remove explicit from Optional constructors

This allows base::nullopt to be used instead of base::Optional<Foo>()
and implicit conversion to Optional<T> from T.

Also added NOLINT comments to the implicit constructors.

Change-Id: I4c688045685e2a50e0c0d38a959570f77454ec61
Reviewed-on: https://chromium-review.googlesource.com/893268Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51003}
parent dc08d4f8
......@@ -125,7 +125,7 @@ class Optional {
constexpr Optional() {}
explicit constexpr Optional(base::nullopt_t) {}
constexpr Optional(base::nullopt_t) {} // NOLINT(runtime/explicit)
Optional(const Optional& other) {
if (!other.storage_.is_null_) Init(other.value());
......@@ -135,10 +135,12 @@ class Optional {
if (!other.storage_.is_null_) Init(std::move(other.value()));
}
explicit constexpr Optional(const T& value) : storage_(value) {}
constexpr Optional(const T& value) // NOLINT(runtime/explicit)
: storage_(value) {}
// TODO(alshabalin): Can't use 'constexpr' with std::move until C++14.
explicit Optional(T&& value) : storage_(std::move(value)) {}
Optional(T&& value) // NOLINT(runtime/explicit)
: storage_(std::move(value)) {}
// TODO(alshabalin): Can't use 'constexpr' with std::forward until C++14.
template <class... Args>
......
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