|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82770 - sandbox/varray/boost/container/detail
From: adam.wulkiewicz_at_[hidden]
Date: 2013-02-07 09:05:28
Author: awulkiew
Date: 2013-02-07 09:05:26 EST (Thu, 07 Feb 2013)
New Revision: 82770
URL: http://svn.boost.org/trac/boost/changeset/82770
Log:
Added disable_trivial_init config to traits, for now handled in varray::resize(n) and varray(n)
Text files modified:
sandbox/varray/boost/container/detail/varray.hpp | 4 +++-
sandbox/varray/boost/container/detail/varray_util.hpp | 21 +++++++++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
Modified: sandbox/varray/boost/container/detail/varray.hpp
==============================================================================
--- sandbox/varray/boost/container/detail/varray.hpp (original)
+++ sandbox/varray/boost/container/detail/varray.hpp 2013-02-07 09:05:26 EST (Thu, 07 Feb 2013)
@@ -170,6 +170,7 @@
typedef boost::false_type use_memop_in_swap_and_move;
typedef boost::false_type use_optimized_swap;
+ typedef boost::false_type disable_trivial_init;
};
/**
@@ -621,6 +622,7 @@
void resize(size_type count)
{
namespace sv = varray_detail;
+ typedef typename vt::disable_trivial_init dti;
if ( count < m_size )
{
@@ -630,7 +632,7 @@
{
errh::check_capacity(*this, count); // may throw
- sv::uninitialized_fill(this->end(), this->begin() + count); // may throw
+ sv::uninitialized_fill(this->end(), this->begin() + count, dti()); // may throw
}
m_size = count; // update end
}
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-07 09:05:26 EST (Thu, 07 Feb 2013)
@@ -465,17 +465,26 @@
template <typename I>
inline
void uninitialized_fill_dispatch(I first, I last,
- boost::true_type const& /*has_trivial_constructor*/)
+ boost::true_type const& /*has_trivial_constructor*/,
+ boost::true_type const& /*disable_trivial_init*/)
+{}
+
+template <typename I>
+inline
+void uninitialized_fill_dispatch(I first, I last,
+ boost::true_type const& /*has_trivial_constructor*/,
+ boost::false_type const& /*disable_trivial_init*/)
{
typedef typename boost::iterator_value<I>::type value_type;
for ( ; first != last ; ++first )
new (boost::addressof(*first)) value_type();
}
-template <typename I>
+template <typename I, typename DisableTrivialInit>
inline
void uninitialized_fill_dispatch(I first, I last,
- boost::false_type const& /*has_trivial_constructor*/)
+ boost::false_type const& /*has_trivial_constructor*/,
+ DisableTrivialInit const& /*not_used*/)
{
typedef typename boost::iterator_value<I>::type value_type;
I it = first;
@@ -493,12 +502,12 @@
BOOST_CATCH_END
}
-template <typename I>
+template <typename I, typename DisableTrivialInit>
inline
-void uninitialized_fill(I first, I last)
+void uninitialized_fill(I first, I last, DisableTrivialInit const& disable_trivial_init)
{
typedef typename boost::iterator_value<I>::type value_type;
- uninitialized_fill_dispatch(first, last, has_trivial_constructor<value_type>()); // may throw
+ uninitialized_fill_dispatch(first, last, has_trivial_constructor<value_type>(), disable_trivial_init); // may throw
}
// construct(I)
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