Closed Krantz-XRF closed 3 years ago
propagate_const
is non-copyable by design and wont accept a pointer to const by design.
If propagate_const were copyable then 'const' could be dropped by copying the propagate const instance. See https://github.com/jbcoe/propagate_const/blob/master/notes_on_design/paper.md
propagate_const won't accept a pointer to const as its purpose is to propagate const-ness to pointees accessed through a const access path. If the pointee is unconditionally const then there is nothing for the class to do. Argaubly this could be permitted but it's probably not useful.
If you are looking for deep pointers, depending what you mean, indirect_value and polymorphic_value may be what you need:
https://github.com/jbcoe/polymorphic_value https://github.com/jbcoe/indirect_value
Both are being considered for addition to a future C++ standard.
I asked about a deep-
const
pointer implementation on Stack Overflow, and was guided to this proposal and implementation. What I needed is a "deep-const" pointer typeP
:P
is pointer-to-const;P
is pointer-to-mutable;P
;P
should be trivially copyable to another constP
.Current
propagate_const
implementation fails to match the requirement because:I wonder whether the limitations above of current
propagate_const
was by design, or due to limitations of the C++ language?