[Boost-bugs] [Boost C++ Libraries] #3472: Setting value_initialized<T> to a value when T is a top-level const

Subject: [Boost-bugs] [Boost C++ Libraries] #3472: Setting value_initialized<T> to a value when T is a top-level const
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-09-21 16:58:13


#3472: Setting value_initialized<T> to a value when T is a top-level const
------------------------------------------------+---------------------------
 Reporter: Edward Diener <eld@…> | Owner: no-maintainer
     Type: Feature Requests | Status: new
Milestone: Boost 1.41.0 | Component: utility
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: value_initialized const |
------------------------------------------------+---------------------------
 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.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3472>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC