Use thread-local in RequestContext::getStaticContext
[folly.git] / folly / MacAddress.h
index 49852edba60b6bbcb4be9934b7c5881d93d2f722..884a2db81a086f58496e43e65a65e4002b385f9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #pragma once
 
-#include <iostream>
+#include <iosfwd>
 
-#include <boost/operators.hpp>
-
-#include <folly/Bits.h>
-#include <folly/Conv.h>
+#include <folly/Range.h>
+#include <folly/lang/Bits.h>
 
 namespace folly {
 
@@ -30,7 +28,7 @@ class IPAddressV6;
 /*
  * MacAddress represents an IEEE 802 MAC address.
  */
-class MacAddress : private boost::totally_ordered<MacAddress> {
+class MacAddress {
  public:
   static constexpr size_t SIZE = 6;
   static const MacAddress BROADCAST;
@@ -167,8 +165,7 @@ class MacAddress : private boost::totally_ordered<MacAddress> {
     return getByte(0) & 0x2;
   }
 
-  // Equality and less-than operators.
-  // boost::totally_ordered provides the other comparison operators.
+  // Comparison operators.
 
   bool operator==(const MacAddress& other) const {
     // All constructors and modifying methods make sure padding is 0,
@@ -180,6 +177,22 @@ class MacAddress : private boost::totally_ordered<MacAddress> {
     return u64HBO() < other.u64HBO();
   }
 
+  bool operator!=(const MacAddress& other) const {
+    return !(*this == other);
+  }
+
+  bool operator>(const MacAddress& other) const {
+    return other < *this;
+  }
+
+  bool operator>=(const MacAddress& other) const {
+    return !(*this < other);
+  }
+
+  bool operator<=(const MacAddress& other) const {
+    return !(*this > other);
+  }
+
  private:
   explicit MacAddress(uint64_t valueNBO) {
     memcpy(&bytes_, &valueNBO, 8);
@@ -209,11 +222,12 @@ class MacAddress : private boost::totally_ordered<MacAddress> {
 
 /* Define toAppend() so to<string> will work */
 template <class Tgt>
-typename std::enable_if<IsSomeString<Tgt>::value>::type
-toAppend(MacAddress address, Tgt* result) {
+typename std::enable_if<IsSomeString<Tgt>::value>::type toAppend(
+    MacAddress address,
+    Tgt* result) {
   toAppend(address.toString(), result);
 }
 
 std::ostream& operator<<(std::ostream& os, MacAddress address);
 
-}  // folly
+} // namespace folly