Changeset 231342 in webkit
- Timestamp:
- May 3, 2018 6:00:18 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r231337 r231342 1 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Use default std::optional if it is provided 4 https://bugs.webkit.org/show_bug.cgi?id=185159 5 6 Reviewed by Michael Catanzaro. 7 8 * wtf/Expected.h: 9 * wtf/Optional.h: 10 Do not use <optional> for clang currently. 11 (WTF::valueOrCompute): 12 1 13 2018-05-03 Filip Pizlo <fpizlo@apple.com> 2 14 -
trunk/Source/WTF/wtf/Expected.h
r231308 r231342 574 574 }}} // namespace std::experimental::fundamentals_v3 575 575 576 __EXPECTED_INLINE_VARIABLE constexpr std::experimental::unexpected_t& unexpect = std::experimental::unexpect;576 __EXPECTED_INLINE_VARIABLE constexpr auto& unexpect = std::experimental::unexpect; 577 577 template<class T, class E> using Expected = std::experimental::expected<T, E>; -
trunk/Source/WTF/wtf/Optional.h
r231308 r231342 47 47 # include <wtf/Compiler.h> 48 48 # include <wtf/StdLibExtras.h> 49 50 #if !COMPILER(MSVC) && !PLATFORM(COCOA) && __has_include(<optional>) 51 # include <optional> 52 #else 49 53 50 54 # define TR2_OPTIONAL_REQUIRES(...) typename std::enable_if<__VA_ARGS__::value, bool>::type = false … … 1013 1017 } // namespace std 1014 1018 1019 namespace std 1020 { 1021 template <typename T> 1022 struct hash<std::optional<T>> 1023 { 1024 typedef typename hash<T>::result_type result_type; 1025 typedef std::optional<T> argument_type; 1026 1027 constexpr result_type operator()(argument_type const& arg) const { 1028 return arg ? std::hash<T>{}(*arg) : result_type{}; 1029 } 1030 }; 1031 1032 template <typename T> 1033 struct hash<std::optional<T&>> 1034 { 1035 typedef typename hash<T>::result_type result_type; 1036 typedef std::optional<T&> argument_type; 1037 1038 constexpr result_type operator()(argument_type const& arg) const { 1039 return arg ? std::hash<T>{}(*arg) : result_type{}; 1040 } 1041 }; 1042 } 1043 1044 # undef TR2_OPTIONAL_REQUIRES 1045 # undef TR2_OPTIONAL_ASSERTED_EXPRESSION 1046 1047 #endif // defined(__cpp_lib_optional) 1048 1015 1049 namespace WTF { 1016 1050 … … 1027 1061 } // namespace WTF 1028 1062 1029 namespace std1030 {1031 template <typename T>1032 struct hash<std::optional<T>>1033 {1034 typedef typename hash<T>::result_type result_type;1035 typedef std::optional<T> argument_type;1036 1037 constexpr result_type operator()(argument_type const& arg) const {1038 return arg ? std::hash<T>{}(*arg) : result_type{};1039 }1040 };1041 1042 template <typename T>1043 struct hash<std::optional<T&>>1044 {1045 typedef typename hash<T>::result_type result_type;1046 typedef std::optional<T&> argument_type;1047 1048 constexpr result_type operator()(argument_type const& arg) const {1049 return arg ? std::hash<T>{}(*arg) : result_type{};1050 }1051 };1052 }1053 1054 # undef TR2_OPTIONAL_REQUIRES1055 # undef TR2_OPTIONAL_ASSERTED_EXPRESSION1056 1057 1063 using WTF::valueOrCompute; -
trunk/Source/WebKit/ChangeLog
r231327 r231342 1 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Use default std::optional if it is provided 4 https://bugs.webkit.org/show_bug.cgi?id=185159 5 6 Reviewed by Michael Catanzaro. 7 8 * Shared/SandboxExtension.h: 9 (WebKit::SandboxExtension::Handle::decode): 10 * Shared/TouchBarMenuItemData.cpp: 11 (WebKit::TouchBarMenuItemData::decode): 12 1 13 2018-05-03 Justin Fan <justin_fan@apple.com> 2 14 -
trunk/Source/WebKit/Shared/SandboxExtension.h
r231308 r231342 121 121 inline SandboxExtension::Handle::~Handle() { } 122 122 inline void SandboxExtension::Handle::encode(IPC::Encoder&) const { } 123 inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return {{ }}; }123 inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return SandboxExtension::Handle { }; } 124 124 inline SandboxExtension::HandleArray::HandleArray() { } 125 125 inline SandboxExtension::HandleArray::~HandleArray() { } -
trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp
r231308 r231342 66 66 return std::nullopt; 67 67 68 return WTFMove(result);68 return std::make_optional(WTFMove(result)); 69 69 } 70 70
Note: See TracChangeset
for help on using the changeset viewer.