Skip to content

Commit 62275af

Browse files
committed
Implement some equality operators
1 parent de71045 commit 62275af

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/packingsolver/box/instance.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ struct Point
3131
Length z;
3232
};
3333

34+
inline bool operator==(const Point& point_1, const Point& point_2) { return point_1.x == point_2.x && point_1.y == point_2.y && point_1.z == point_2.z; }
35+
inline bool operator!=(const Point& point_1, const Point& point_2) { return !(point_1 == point_2); }
36+
3437
std::ostream& operator<<(
3538
std::ostream& os,
3639
Point xyz);
@@ -78,6 +81,9 @@ struct Box
7881

7982
};
8083

84+
inline bool operator==(const Box& box_1, const Box& box_2) { return box_1.x == box_2.x && box_1.y == box_2.y && box_1.z == box_2.z; }
85+
inline bool operator!=(const Box& box_1, const Box& box_2) { return !(box_1 == box_2); }
86+
8187
std::ostream& operator<<(
8288
std::ostream& os,
8389
Box box);

include/packingsolver/box/solution.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ struct SolutionItem
1919
int rotation;
2020
};
2121

22+
inline bool operator==(const SolutionItem& solution_item_1, const SolutionItem& solution_item_2) { return solution_item_1.item_type_id == solution_item_2.item_type_id && solution_item_1.bl_corner == solution_item_2.bl_corner && solution_item_1.rotation == solution_item_2.rotation; }
23+
inline bool operator!=(const SolutionItem& solution_item_1, const SolutionItem& solution_item_2) { return !(solution_item_1 == solution_item_2); }
24+
2225
struct SolutionBin
2326
{
2427
/** Bin type. */

0 commit comments

Comments
 (0)