Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82067 - sandbox/static_vector/boost/container
From: athundt_at_[hidden]
Date: 2012-12-18 03:10:36


Author: ahundt
Date: 2012-12-18 03:10:36 EST (Tue, 18 Dec 2012)
New Revision: 82067
URL: http://svn.boost.org/trac/boost/changeset/82067

Log:
static_vector.hpp made note of swap linear complexity, updated size_type, updated address access to use boost::addressof()
Text files modified:
   sandbox/static_vector/boost/container/static_vector.hpp | 9 +++++----
   1 files changed, 5 insertions(+), 4 deletions(-)

Modified: sandbox/static_vector/boost/container/static_vector.hpp
==============================================================================
--- sandbox/static_vector/boost/container/static_vector.hpp (original)
+++ sandbox/static_vector/boost/container/static_vector.hpp 2012-12-18 03:10:36 EST (Tue, 18 Dec 2012)
@@ -132,7 +132,7 @@
 
 public:
     typedef Value value_type;
- typedef std::size_t size_type;
+ typedef StoredSizeType size_type;
     typedef std::ptrdiff_t difference_type;
     typedef Value& reference;
     typedef Value const& const_reference;
@@ -212,6 +212,7 @@
     }
 
     // nothrow
+ // swap (note: linear complexity)
     void swap(static_vector & other)
     {
 // iterator it = this->begin();
@@ -244,6 +245,7 @@
     }
 
     // basic
+ // swap (note: linear complexity)
     template <std::size_t C, typename S>
     void swap(static_vector<value_type, C, S> & other)
     {
@@ -339,6 +341,7 @@
 
         this->uninitialized_fill(this->end(), *(this->end() - 1)); // may throw
         ++m_size; // update end
+
         if ( position != this->end() )
         {
             // TODO - should following lines check for exception and revert to the old size?
@@ -827,9 +830,7 @@
     void fill_dispatch(value_type * ptr, value_type const& v,
                        boost::true_type const& /*has_trivial_assign*/)
     {
- // TODO - check if value_type has operator& defined and call this version only if it hasn't
- const value_type * vptr = &v;
- ::memcpy(ptr, vptr, sizeof(value_type));
+ ::memcpy(ptr, boost::addressof(v), sizeof(value_type));
     }
 
     template <typename 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