Future<Unit> global fixup
[folly.git] / folly / Optional.h
index 032022b17883138083f178de17a14a4d6bf08507..f4bc9ff4ce7a36bb47eb82f7a5d49a4d5d7a7e10 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -87,6 +87,8 @@ class Optional {
  public:
   static_assert(!std::is_reference<Value>::value,
                 "Optional may not be used with reference types");
+  static_assert(!std::is_abstract<Value>::value,
+                "Optional may not be used with abstract types");
 
   Optional()
     : hasValue_(false) {
@@ -295,7 +297,7 @@ bool operator!=(const Optional<V>& a, const V& b) {
 }
 
 template<class V>
-bool operator==(const V& a, const Optional<V&> b) {
+bool operator==(const V& a, const Optional<V>& b) {
   return b.hasValue() && b.value() == a;
 }
 
@@ -338,7 +340,7 @@ bool operator>=(const Optional<V>& a, const Optional<V>& b) {
   return !(a < b);
 }
 
-// To supress comparability of Optional<T> with T, despite implicit conversion.
+// Suppress comparability of Optional<T> with T, despite implicit conversion.
 template<class V> bool operator< (const Optional<V>&, const V& other) = delete;
 template<class V> bool operator<=(const Optional<V>&, const V& other) = delete;
 template<class V> bool operator>=(const Optional<V>&, const V& other) = delete;