Add tcu::just() that wraps argument in to tcu::Maybe.
authorMika Isojärvi <misojarvi@google.com>
Fri, 13 Feb 2015 20:48:55 +0000 (12:48 -0800)
committerMika Isojärvi <misojarvi@google.com>
Tue, 17 Feb 2015 21:52:06 +0000 (13:52 -0800)
Sometimes relying on implicit conversions is not enough and writing
complete constructor of tcu::Maybe<T> is tedious.

Change-Id: I945ada922e6507152f30109773425401cefd54a3

framework/common/tcuMaybe.hpp

index 62110a9..135486d 100644 (file)
@@ -66,6 +66,12 @@ Maybe<T> nothing (void)
 }
 
 template<typename T>
+Maybe<T> just (const T& value)
+{
+       return Maybe<T>(value);
+}
+
+template<typename T>
 Maybe<T>::Maybe (void)
        : m_ptr (DE_NULL)
 {