Make WTF::Expected support Ref template parameters
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2017 23:18:45 +0000 (23:18 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2017 23:18:45 +0000 (23:18 +0000)
commite9614ca4bcb7c3382d61eb92ae23ab5352b745b4
treeec7531dfbee5ee873c8d63d619977d678a900c58
parent2a341f610a460a67a65a7033eed556b47c6cd97b
Make WTF::Expected support Ref template parameters
https://bugs.webkit.org/show_bug.cgi?id=166662

Reviewed by Alex Christensen.

Source/WTF:

Tests: Added to TestWebKitAPI/Expected.cpp

* wtf/Expected.h:
(WTF::UnexpectedType::value):
Add overloads based on this value type to allow getting at the value
as an rvalue for moving the error into the Expected.

(WTF::Expected::Expected):
Add overload that takes an ErrorType/UnexpectedType<ErrorType> as an rvalue.

(WTF::Expected::swap):
Move the temporary value/error rather than copying.

Tools:

* TestWebKitAPI/Tests/WTF/Expected.cpp:
(TestWebKitAPI::TEST):
Add tests for using Ref with Expected.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Expected.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Expected.cpp