Flesh out Optional members swap, reset, emplace, has_value
authorYedidya Feldblum <yfeldblum@fb.com>
Wed, 25 Oct 2017 05:05:23 +0000 (22:05 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 25 Oct 2017 05:08:24 +0000 (22:08 -0700)
commit2ca10eeefdc1231a20fb1cb75dc3e8d2c5fa70ba
treec5f4d35c6d732d5fc739a197444ba67da336a418
parent2f5439e49c2d1403e0ed9568562bb534a67ffc21
Flesh out Optional members swap, reset, emplace, has_value

Summary:
[Folly] Flesh out `Optional` members `swap`, `reset`, `emplace`, `has_value`.

* `swap` as a member and deriving `noexcept`-ness to mimic `std::optional::swap`.
* `reset` v.s. `clear` to mimic `std::optional::reset`.
* `emplace` returning ref and overload taking initializer list to mimic `std::optional::emplace`.
* `has_value` v.s. `hasValue` to mimic `std::optional::has_value`.

Reviewed By: WillerZ

Differential Revision: D6132775

fbshipit-source-id: 34c58367b9dc63289e4b9721c5e79b1c41ba31e4
folly/Optional.h
folly/test/OptionalTest.cpp