Ticket #3472 (closed Feature Requests: fixed)
Setting value_initialized<T> to a value when T is a top-level const
|Reported by:||Edward Diener <eld@…>||Owned by:||fcacciola|
There is no way to set value_initialized<T> object to the non-initialized value when T is a top-level const. I think there should be.
While it is not allowed to set a const value to a value after construction, one can usually set it to a value at construction time. The value_initialized<T> has no way to do that. Adding a constructor to it, which would allow the value to be set to something other than its default value initialized state, would solve this problem for T when it is a top-level const.
A practical use case is that value_initialized<T> might be used in a template class where T is a template parameter of that particular template class. If the end-user specifies that T is a top-level const, then an initial value for T passed to that template class's constructor can not be used to set a value_initialized<T> object to that value, making value_initialized<T> unusable in such a situation.
Adding a constructor to value_initialized<T> would solve that problem.
- Cc niels_address_until_2010-10-10@… added
- Owner changed from no-maintainer to fcacciola