[llvm] SmallVector: add missing constexpr annotations (NFC) (PR #98296)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 07:57:41 PDT 2024
artagnon wrote:
> > I've gone through https://en.cppreference.com/w/cpp/language/constexpr, and there doesn't seem to be a relationship between constexpr functions and constexpr constructors, but maybe I'm missing something?
>
> If you know the exact size, why not use std::array?
So, my approach is to keep the entire Matrix as a single SmallVectorImpl, and I have a view over that that can slice out submatrices and provide a double-indexing operator: operator[] can't take multiple arguments until C++23, so I do indeed keep a std::array of MutableArrayRefs for the row views, and on single-indexing, I return one of them, which again has an operator[] to get the double-indexing. The entire construction, modulo the dynamic resizing, is full of compile-time expressions.
https://github.com/llvm/llvm-project/pull/98296
More information about the llvm-commits
mailing list