You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
Mark had mentioned earlier that supporting the memory resources in std::pmr was a hurdle that mdarray needed to get over;std::pmr::polymorphic_allocator follows the same scoped allocator model that is supported by std::scoped_allocator_adaptor and std::uses_allocator. Unless I'm missing something, the main things needed to fully support the scoped allocator model (when container_type::allocator_type exists) are:
Add a constructor to basic_mdarray that allows it to have an allocator passed in that passes the allocator to container_policy::create()
Support T(std::allocator_arg, alloc, size) as a possible container constructor and
Partial specialize std::uses_allocator to be based on basic_mdarray::container_type
I should be able to piece together most of a PR implementing uses allocator construction over the weekend.
Edit: got a bit ahead of myself and forgot that the relevant policy was specifically for vectors; supporting uses allocator construction for other containers would be the responsibility of the relevant policy.
The text was updated successfully, but these errors were encountered:
Yeup, accounting for non-allocator aware containers is the biggest confounding issue, and why I ended up resorting to raw SFINAE.
My thinking is that I need template argument deduction to fail so I can get the allocator type in a dependent context. Naming it in a non-dependent context produces a compile time error. The type trait for getting the allocator type produces a hard error at template deduction, not a SFINAE error, and constraints are checked during overload resolution after template deduction. The only thing I could think of (aside from partial specialization) was to guard getting the allocator type through a defaulted template parameter behind a SFINAE error.
Of course I absolutely could have missed something, but this was the only way I could get it to compile 🙃
Note: we are changing the design of mdarray to get rid of container policy. Its not clear that that thing really provides much value. Basically we just gonna template on the container itself. I will upload a draft new version later today. Did not have time to look at implementation yet.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Mark had mentioned earlier that supporting the memory resources in
std::pmr
was a hurdle thatmdarray
needed to get over;std::pmr::polymorphic_allocator
follows the same scoped allocator model that is supported bystd::scoped_allocator_adaptor
andstd::uses_allocator
. Unless I'm missing something, the main things needed to fully support the scoped allocator model (whencontainer_type::allocator_type
exists) are:basic_mdarray
that allows it to have an allocator passed in that passes the allocator tocontainer_policy::create()
SupportT(std::allocator_arg, alloc, size)
as a possible container constructor andstd::uses_allocator
to be based onbasic_mdarray::container_type
I should be able to piece together most of a PR implementing uses allocator construction over the weekend.
Edit: got a bit ahead of myself and forgot that the relevant policy was specifically for vectors; supporting uses allocator construction for other containers would be the responsibility of the relevant policy.
The text was updated successfully, but these errors were encountered: