Skip to content

Commit 47b8a15

Browse files
committed
fix(MeshElement): add operator<
1 parent 36a522d commit 47b8a15

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

include/geode/basic/uuid.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ namespace geode
104104
uuid &operator=( const uuid &other ) = default;
105105
~uuid() = default;
106106

107-
bool operator==( const uuid &other ) const;
107+
[[nodiscard]] bool operator==( const uuid &other ) const;
108108

109-
bool operator!=( const uuid &other ) const;
109+
[[nodiscard]] bool operator!=( const uuid &other ) const;
110110

111-
bool operator<( const uuid &other ) const;
111+
[[nodiscard]] bool operator<( const uuid &other ) const;
112112

113113
[[nodiscard]] std::string string() const;
114114

include/geode/mesh/core/mesh_element.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ namespace geode
4747

4848
[[nodiscard]] bool operator!=( const MeshElement& other ) const
4949
{
50-
return mesh_id != other.mesh_id || element_id != other.element_id;
50+
return !operator==( other );
51+
}
52+
53+
[[nodiscard]] bool operator<( const MeshElement& other ) const
54+
{
55+
if( mesh_id != other.mesh_id )
56+
{
57+
return mesh_id < other.mesh_id;
58+
}
59+
return element_id < other.element_id;
5160
}
5261

5362
template < typename Archive >

0 commit comments

Comments
 (0)