|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82681 - sandbox/varray/boost/container/detail
From: adam.wulkiewicz_at_[hidden]
Date: 2013-02-06 20:24:00
Author: awulkiew
Date: 2013-02-01 13:43:53 EST (Fri, 01 Feb 2013)
New Revision: 82681
URL: http://svn.boost.org/trac/boost/changeset/82681
Log:
varray elements with trivial ctor are now initialized.
Text files modified:
sandbox/varray/boost/container/detail/varray_util.hpp | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
Modified: sandbox/varray/boost/container/detail/varray_util.hpp
==============================================================================
--- sandbox/varray/boost/container/detail/varray_util.hpp (original)
+++ sandbox/varray/boost/container/detail/varray_util.hpp 2013-02-01 13:43:53 EST (Fri, 01 Feb 2013)
@@ -464,9 +464,13 @@
template <typename I>
inline
-void uninitialized_fill_dispatch(I /*first*/, I /*last*/,
+void uninitialized_fill_dispatch(I first, I last,
boost::true_type const& /*has_trivial_constructor*/)
-{}
+{
+ typedef typename boost::iterator_value<I>::type value_type;
+ for ( ; first != last ; ++first )
+ new (boost::addressof(*first)) value_type();
+}
template <typename I>
inline
@@ -501,27 +505,10 @@
template <typename I>
inline
-void construct_dispatch(I pos,
- ::boost::mpl::bool_<true> const& /*empty_constr*/)
-{}
-
-template <typename I>
-inline
-void construct_dispatch(I pos,
- ::boost::mpl::bool_<false> const& /*empty_constr*/)
-{
- typedef typename ::boost::iterator_value<I>::type V;
- new (static_cast<void*>(::boost::addressof(*pos))) V(); // may throw
-}
-
-template <typename I>
-inline
void construct(I pos)
{
- typedef typename ::boost::iterator_value<I>::type V;
- typedef typename ::boost::has_trivial_constructor<V>::type empty_constr;
-
- construct_dispatch(pos, empty_constr()); // may throw
+ typedef typename ::boost::iterator_value<I>::type value_type;
+ new (static_cast<void*>(::boost::addressof(*pos))) value_type(); // may throw
}
// construct(I, V)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk