Opened 5 years ago

Last modified 5 years ago

#13099 new Feature Requests

How about adding BOOST_CONSEXPR to functions in rational where appropriate

Reported by: Robert Ramey Owned by: Daryle Walker
Milestone: To Be Determined Component: rational
Version: Boost 1.63.0 Severity: Optimization
Keywords: rational constexpr Cc:

Description

How about adding BOOST_CONSEXPR to functions in rational where appropriate. I shouldn't create any problems and would make boost rational more useful in current code.

Change History (2)

comment:1 by Robert Ramey, 5 years ago

Owner: changed from John Maddock to Daryle Walker

Hmmm - I looked at the code and it seems I over reacted. Many of the functions are constexpr. The particular one I was interested in isn't. This function is operator * (.. The way it's implemented in terms of *= inhibits it from being constexpr. Perhaps the implementation might be tweaked to over come this.

comment:2 by John Maddock, 5 years ago

Hi Robert, now that gcd/lcm are constexpr I'm fairly sure this is possible now (in C++14 that is). However, since this isn't my library, and I'm pushed for time, my suggestion would be that you submit a PR ;)

It would be good to have fully constexpr rational arithmetic though...

Note: See TracTickets for help on using tickets.