Replace Maybe with std::optional
With c++17, std::optional provides the functionality that Maybe
provided.
Bug: 183215655
Test: aapt2_tests
Change-Id: I62bb9c2fa4985dc5217a6ed153df92b85ad9a034
diff --git a/tools/aapt2/io/FileSystem.cpp b/tools/aapt2/io/FileSystem.cpp
index e15f935..fc2e45e 100644
--- a/tools/aapt2/io/FileSystem.cpp
+++ b/tools/aapt2/io/FileSystem.cpp
@@ -21,11 +21,10 @@
#include "android-base/errors.h"
#include "androidfw/StringPiece.h"
#include "utils/FileMap.h"
-
#include "Source.h"
#include "io/FileStream.h"
#include "util/Files.h"
-#include "util/Maybe.h"
+
#include "util/Util.h"
using ::android::StringPiece;
@@ -38,7 +37,7 @@
std::unique_ptr<IData> RegularFile::OpenAsData() {
android::FileMap map;
- if (Maybe<android::FileMap> map = file::MmapPath(source_.path, nullptr)) {
+ if (std::optional<android::FileMap> map = file::MmapPath(source_.path, nullptr)) {
if (map.value().getDataPtr() && map.value().getDataLength() > 0) {
return util::make_unique<MmappedData>(std::move(map.value()));
}