-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a constexpr size function #94
Comments
This is because of SVE basically where the size of SIMD vectors is not known at compile time but only at runtime. That's why none of the NSIMD constructs are constexpr. If you look at the headers you will see the use May I ask in which construct you need the size at compile time? |
I was defining a constexpr size_t vsize = pack<double>().size();
constexpr size_t N = (2*order+1 + vsize - 1) / vsize * vsize;
array<T,N> tmp; I am currently using |
Ah ok, in this case maybe #if NSIMD_CXX >= 2014
template <NSIMD_CONCEPT_VALUE_TYPE T>
constexpr int max_len = max_len_t<T>::value;
#endif The downside is that its value is huge (namely
In any case be careful with |
Thanks. I'm using the value only for a temporary array, so I don't have a need for an architecture-independent value. |
I could not find a way to use the
size()
function of the C++pack
structure in aconstexpr
manner. For example, this fails:because the constructor
pack<double>()
is not constexpr.I believe one way to obtain the size of a fixed-size container is via
tuple_size
. This works e.g. forstd::array
as well. One could then writeThe text was updated successfully, but these errors were encountered: