Opened 11 years ago

#6614 new Feature Requests

Start adapting Quaternions and Octonions for C++11

Reported by: Daryle Walker Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.49.0 Severity: Optimization
Keywords: quaternion octonion constexpr noexcept Cc:

Description

When I read up on C++11 features like constexpr and noexcept, I wonder what classes in Boost can be adapted for them. The quaternion and octonion class templates represent value-types that can easily be made constexpr compliant. Further, the specializations for the built-in floating-point types can be made noexcept for their operations. I have a patch that starts work on both fronts.

Since the library is implemented with macro madness, I can't change too much without making the file unrecognizable to diff utilities. This means that some stuff in the specializations that could be noexcept can't be since they share textual implementation with the general templates' versions of the code.

Some aggresive marking of constructors as explicit has been toned down, still conforming to the docs. Speaking of which, they have been changed to match the new code (plus two doc errors).

For future directions, the big hurdle is the idiom that binary-operator @@ is implemented in terms of @@=. That's generally OK in C++03, but now it disqualifies the former from being declared constexpr since the latter is mutating. Fixing this would entail flipping the relationship between the functions around.

Attachments (1)

quaternion_cpp11.diff (152.2 KB ) - added by Daryle Walker 11 years ago.
Changes for C++11 adaptation

Download all attachments as: .zip

Change History (1)

by Daryle Walker, 11 years ago

Attachment: quaternion_cpp11.diff added

Changes for C++11 adaptation

Note: See TracTickets for help on using tickets.