diff --git a/src/util/guidance/turn_lanes.cpp b/src/util/guidance/turn_lanes.cpp index 79d461878..cba73fdb1 100644 --- a/src/util/guidance/turn_lanes.cpp +++ b/src/util/guidance/turn_lanes.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -24,10 +25,8 @@ LaneTupel::LaneTupel(const LaneID lanes_in_turn, const LaneID first_lane_from_th // comparation based on interpretation as unsigned 32bit integer bool LaneTupel::operator==(const LaneTupel other) const { - static_assert(sizeof(LaneTupel) == sizeof(std::uint16_t), - "Comparation requires LaneTupel to be the of size 16Bit"); - return *reinterpret_cast(this) == - *reinterpret_cast(&other); + return std::tie(lanes_in_turn, first_lane_from_the_right) == + std::tie(other.lanes_in_turn, other.first_lane_from_the_right); } bool LaneTupel::operator!=(const LaneTupel other) const { return !(*this == other); } @@ -35,10 +34,8 @@ bool LaneTupel::operator!=(const LaneTupel other) const { return !(*this == othe // comparation based on interpretation as unsigned 32bit integer bool LaneTupel::operator<(const LaneTupel other) const { - static_assert(sizeof(LaneTupel) == sizeof(std::uint16_t), - "Comparation requires LaneTupel to be the of size 16Bit"); - return *reinterpret_cast(this) < - *reinterpret_cast(&other); + return std::tie(lanes_in_turn, first_lane_from_the_right) < + std::tie(other.lanes_in_turn, other.first_lane_from_the_right); } } // namespace guidance