/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 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/Bits.h>
+#include <folly/Range.h>
namespace folly {
/*
* 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;
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,
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);