Construct Later with exception_ptr
[folly.git] / folly / IPAddress.h
index c5f57aadd9584f754d89288bbca46c7a351e5574..e147c10d7bc599970e9401f70ee975f90edfea38 100644 (file)
 
 #include <boost/operators.hpp>
 
-#include "folly/Format.h"
-#include "folly/Range.h"
-#include "folly/IPAddressException.h"
-#include "folly/IPAddressV4.h"
-#include "folly/IPAddressV6.h"
-#include "folly/detail/IPAddress.h"
+#include <folly/Format.h>
+#include <folly/Range.h>
+#include <folly/IPAddressException.h>
+#include <folly/IPAddressV4.h>
+#include <folly/IPAddressV6.h>
+#include <folly/detail/IPAddress.h>
 
 namespace folly {
 
@@ -251,6 +251,12 @@ class IPAddress : boost::totally_ordered<IPAddress> {
     return isV6() && asV6().isIPv4Mapped();
   }
 
+  // @return true if address is uninitialized
+  bool empty() const { return (family_ == AF_UNSPEC); }
+
+  // @return true if address is initialized
+  explicit operator bool() { return !empty(); }
+
   // @return true if this is an IPAddressV4 instance
   bool isV4() const { return (family_ == AF_INET); }