Add compile-time support for creating and calculating with vectors and matrices.

Issue #163 new
Lénárd Szolnoki created an issue

A possible way to add constexpr support for the library.

Add LiteralVector and LiteralMatrix types and make their constructors and operators constexpr. Also add constexpr constructors for the Static counterparts that convert from these new types (it should be possible). non-constexpr conversion to the dynamic vector and matrix types could be written too. Then the vector and matrix types would structure like this:

  • LiteralVector, LiteralMatrix: literal types with constexpr operators (meant for compile-time calculations). Also converts to StaticVector and StaticMatrix in compile time.
  • StaticVector, StaticMatrix: literal types with non-constexpr operators (optimized for runtime performance)
  • DynamicVector, DynamicMatrix: non-literal types

I don't know if this is the most elegant way to add compile-time support though. Thoughts?

Comments (1)

  1. Klaus Iglberger

    Hi Lénárd!

    Thanks a lot for creating this proposal. We agree that this would be a great addition to Blaze and even have the same idea on our internal wish list. However, since there is many more important issues we've currently given the issue a low priority. Our plan is to revisit the issue when we switch to C++17 (which will happen in the release of Blaze 4.0). Hopefully the extended compile time support of C++17 (e.g. if constexpr) will help us to implement this feature. Thanks again for creating this issue (it will serve as a great reminder),

    Best regards,

    Klaus!

  2. Log in to comment