Skip to content

Commit 77be9e4

Browse files
Simplifies definitions of world Invalid*ID constants
1 parent 9b164d0 commit 77be9e4

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

Library/include/playrho/BodyID.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using BodyID = detail::IndexingNamedType<BodyCounter, struct BodyIdentifier>;
4242
/// @brief Invalid body ID value.
4343
/// @details A special, reserved value of a @c BodyID that represents/identifies an _invalid_ body.
4444
/// @see BodyID, IsValid.
45-
constexpr auto InvalidBodyID = static_cast<BodyID>(static_cast<BodyID::underlying_type>(-1));
45+
constexpr auto InvalidBodyID = BodyID{static_cast<BodyID::underlying_type>(-1)};
4646

4747
/// @brief Determines validity of given value by comparing against <code>InvalidBodyID</code>.
4848
/// @return true if not equal to @c InvalidBodyID , else false.

Library/include/playrho/ContactID.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ using ContactID = detail::IndexingNamedType<ContactCounter, struct ContactIdenti
4343
/// @brief Invalid contact ID value.
4444
/// @details A special, reserved value of a @c ContactID that represents/identifies an _invalid_ contact.
4545
/// @see ContactID, IsValid.
46-
constexpr auto InvalidContactID =
47-
static_cast<ContactID>(static_cast<ContactID::underlying_type>(-1));
46+
constexpr auto InvalidContactID = ContactID{static_cast<ContactID::underlying_type>(-1)};
4847

4948
/// @brief Determines validity of given value by comparing against <code>InvalidContactID</code>.
5049
/// @return true if not equal to @c InvalidContactID , else false.

Library/include/playrho/JointID.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using JointID = detail::IndexingNamedType<JointCounter, struct JointIdentifier>;
4242
/// @brief Invalid joint ID value.
4343
/// @details A special, reserved value of a @c JointID that represents/identifies an _invalid_ joint.
4444
/// @see JointID, IsValid.
45-
constexpr auto InvalidJointID = static_cast<JointID>(static_cast<JointID::underlying_type>(-1));
45+
constexpr auto InvalidJointID = JointID{static_cast<JointID::underlying_type>(-1)};
4646

4747
/// @brief Determines validity of given value by comparing against <code>InvalidJointID</code>.
4848
/// @return true if not equal to @c InvalidJointID , else false.

Library/include/playrho/ShapeID.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using ShapeID = detail::IndexingNamedType<ShapeCounter, struct ShapeIdentifier>;
4242
/// @brief Invalid shape ID value.
4343
/// @details A special, reserved value of a @c ShapeID that represents/identifies an _invalid_ shape.
4444
/// @see ShapeID, IsValid.
45-
constexpr auto InvalidShapeID = static_cast<ShapeID>(static_cast<ShapeID::underlying_type>(-1));
45+
constexpr auto InvalidShapeID = ShapeID{static_cast<ShapeID::underlying_type>(-1)};
4646

4747
/// @brief Determines validity of given value by comparing against <code>InvalidShapeID</code>.
4848
/// @return true if not equal to @c InvalidShapeID , else false.

0 commit comments

Comments
 (0)