[Boost-bugs] [Boost C++ Libraries] #11628: small_vector<int, n> iterates over elements in destructor

Subject: [Boost-bugs] [Boost C++ Libraries] #11628: small_vector<int, n> iterates over elements in destructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-08 22:43:17


#11628: small_vector<int,n> iterates over elements in destructor
----------------------------------+------------------------
 Reporter: benjamin.redelings@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
----------------------------------+------------------------
 In the destruction of a small_vector<int,10>, gdb reveals that the
 integers are individually destroyed, which makes destruction linear in the
 size of the object.

 The code that does this linear-time destruction is the code below from
 container/detail/copy_move_algo.hpp:

 template
   <typename Allocator,
    typename I, // I models InputIterator
   ,typename U> // U models unsigned integral constant
 inline typename container_detail::disable_if_trivially_destructible<I,
 void>::type
 destroy_alloc_n(Allocator &a, I f, U n)
 {
 while(n--){
 allocator_traits<Allocator>::destroy(a,container_detail::iterator_to_raw_pointer(f));
     ++f;
 }

 Since int is a POD type, it seems that this loop shouldn't be executed.
 It appears that the type variable I takes on the value "int*".

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11628>
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:19 UTC