Add BookLevel != operator
Define both == and != operators in BookLevel.cc
This commit is contained in:
1 parent
09fb35c80b
commit
b0affc8611
2 files changed
+21
-9
No files matched your search
@@ -0,0 +1,14 @@
|
||||
#include "BookLevel.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
constexpr bool BookLevel::operator==(const BookLevel &other) const {
|
||||
return price == other.price && quantity == other.quantity &&
|
||||
n_orders == other.n_orders;
|
||||
}
|
||||
|
||||
constexpr bool BookLevel::operator!=(const BookLevel &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include "server/sparkd/cmds/spartan/domain/Quantity.h"
|
||||
#include "server/sparkd/cmds/spartan/domain/Price.h"
|
||||
#include "server/sparkd/cmds/spartan/domain/Quantity.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
@@ -11,11 +9,11 @@ class BookLevel {
|
||||
Price price;
|
||||
Quantity quantity = Quantity{0};
|
||||
int32_t n_orders = 0;
|
||||
bool operator==(BookLevel const &other) const {
|
||||
return price == other.price &&
|
||||
quantity.value() == other.quantity.value() &&
|
||||
n_orders == other.n_orders;
|
||||
}
|
||||
|
||||
constexpr bool operator==(const BookLevel &) const;
|
||||
constexpr bool operator!=(const BookLevel &) const;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace bts::spartan::mdp3
|
||||
|
||||
#include "BookLevel.cc"
|
||||
Reference in new issue
Block a user