Skip to content

Commit

Permalink
Replace deprecated std::is_pod (#6717)
Browse files Browse the repository at this point in the history
* Replace deprecated std::is_pod
  • Loading branch information
nyllet authored Mar 17, 2024
1 parent 016440f commit 8526cc7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
20 changes: 14 additions & 6 deletions include/util/coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,20 @@ using FloatLongitude = Alias<double, tag::longitude>;
// range checks on these (toFixed/toFloat, etc)
using UnsafeFloatLatitude = Alias<double, tag::unsafelatitude>;
using UnsafeFloatLongitude = Alias<double, tag::unsafelongitude>;
static_assert(std::is_pod<FixedLatitude>(), "FixedLatitude is not a valid alias");
static_assert(std::is_pod<FixedLongitude>(), "FixedLongitude is not a valid alias");
static_assert(std::is_pod<FloatLatitude>(), "FloatLatitude is not a valid alias");
static_assert(std::is_pod<FloatLongitude>(), "FloatLongitude is not a valid alias");
static_assert(std::is_pod<UnsafeFloatLatitude>(), "UnsafeFloatLatitude is not a valid alias");
static_assert(std::is_pod<UnsafeFloatLongitude>(), "UnsafeFloatLongitude is not a valid alias");
static_assert(std::is_standard_layout<FixedLatitude>() && std::is_trivial<FixedLatitude>(),
"FixedLatitude is not a valid alias");
static_assert(std::is_standard_layout<FixedLongitude>() && std::is_trivial<FixedLongitude>(),
"FixedLongitude is not a valid alias");
static_assert(std::is_standard_layout<FloatLatitude>() && std::is_trivial<FloatLatitude>(),
"FloatLatitude is not a valid alias");
static_assert(std::is_standard_layout<FloatLongitude>() && std::is_trivial<FloatLongitude>(),
"FloatLongitude is not a valid alias");
static_assert(std::is_standard_layout<UnsafeFloatLatitude>() &&
std::is_trivial<UnsafeFloatLatitude>(),
"UnsafeFloatLatitude is not a valid alias");
static_assert(std::is_standard_layout<UnsafeFloatLongitude>() &&
std::is_trivial<UnsafeFloatLongitude>(),
"UnsafeFloatLongitude is not a valid alias");

/**
* Converts a typed latitude from floating to fixed representation.
Expand Down
3 changes: 2 additions & 1 deletion include/util/fingerprint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ struct FingerPrint

static_assert(sizeof(FingerPrint) == 8, "FingerPrint has unexpected size");
static_assert(std::is_trivial<FingerPrint>::value, "FingerPrint needs to be trivial.");
static_assert(std::is_pod<FingerPrint>::value, "FingerPrint needs to be a POD.");
static_assert(std::is_standard_layout<FingerPrint>::value,
"FingerPrint needs have a standard layout.");
} // namespace osrm::util

#endif /* FingerPrint_H */
6 changes: 4 additions & 2 deletions include/util/typedefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ struct turn_penalty
using OSMNodeID = osrm::Alias<std::uint64_t, tag::osm_node_id>;
// clang-tidy fires `bugprone-throw-keyword-missing` here for unknown reason
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
static_assert(std::is_pod<OSMNodeID>(), "OSMNodeID is not a valid alias");
static_assert(std::is_standard_layout<OSMNodeID>() && std::is_trivial<OSMNodeID>(),
"OSMNodeID is not a valid alias");
using OSMWayID = osrm::Alias<std::uint64_t, tag::osm_way_id>;
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
static_assert(std::is_pod<OSMWayID>(), "OSMWayID is not a valid alias");
static_assert(std::is_standard_layout<OSMWayID>() && std::is_trivial<OSMWayID>(),
"OSMWayID is not a valid alias");

using DuplicatedNodeID = std::uint64_t;
using RestrictionID = std::uint64_t;
Expand Down

0 comments on commit 8526cc7

Please sign in to comment.