Closed stellarpower closed 2 years ago
Good points. Basically everything that can be constexpr should be constexpr, so it's just a matter of using the correct Boost macros to avoid breaking old compilers.
Zero-overhead, I think that was my thinking, hopefully it shouldn't require changing anything except enabling via a macro where possible. As you say, the standard library has taken the same principle - if it can reduce to a constant expression then it ought to. Makes basic getters and setters cheap in the worst case and free in the best. If QVM can support this for some operations then it's a nice bonus if targetting a recent standard.
Separate thread, but I wonder if there would be a way to do the same for concepts and constraints, falling back to enable_if if not possible. For more readable errors. That's a much larger modification however.
Yeah maybe it's possible to come up with some macro trickery to support both. Probably not very many people would care for old compilers, but it can be really painful so I don't want to break it.
I'll try to pull this and give a test, when I can find the time. Thakns!
It's now in the master
branch, though it didn't make it in the current Boost release.
I'm in mamba actually, so it may be easy enough to clone the env and pull the new headers. I've commented out all my previous constexpr specifiers, so it should be easy enough to grep through with those, rebuild, and see if it all works as expected. Just really busy right now. Thanks for the work!
14 Dec 2021 18:24:03 Emil Dotchevski @.***>:
It's now in the master branch, though it didn't make it in the current Boost release.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub[https://github.com/boostorg/qvm/issues/34#issuecomment-993858010], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABGF2ANMPJXEAXBPNGOEGH3UQ6DUFANCNFSM5IRWXN2Q]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAArSURBVHic7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAA+DFFIAAEctgHwAAAAAElFTkSuQmCC###24x24:true###][Tracking image][https://github.com/notifications/beacon/ABGF2APBL3Q5JPCLFAHIIALUQ6DUFA5CNFSM5IRWXN22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHM6RDWQ.gif]
The work is not complete, I've basically added constexpr
where it's easy to add.
Hi,
Looks to me like a good amount of QVM would have support for evaluating as constant expressions, and indeed operations like element access require template parameters and so far are all working for me in constexpr functions. I may of course be overlooking a massive implementation detail, but as QVM targets C++03, there would be no impetus to make the library constexpr in general, so I think that it would be possible to provide limited support for a subset of operations to be constexpr where this is mathematically possible, and this would be a nice feature to have for those of us compiling against a more modern standard. I am using QVM combined with strong types and unit wrapping, converting between different co-ordinate systems. Certainly would be nice to show how everything just evaporates away once it's compiled and is no slower than using floats!
Proposal:
Thanks.