[Boost-bugs] [Boost C++ Libraries] #11244: A version of vector optimized for the empty case

Subject: [Boost-bugs] [Boost C++ Libraries] #11244: A version of vector optimized for the empty case
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-25 19:55:43


#11244: A version of vector optimized for the empty case
------------------------------+--------------------------
 Reporter: marc.glisse@… | Owner: igaztanaga
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.58.0 | Severity: Optimization
 Keywords: |
------------------------------+--------------------------
 Hello,

 it would be useful if boost could provide a version of vector optimized
 for the case where the vector is empty. In particular,
 sizeof(vector)==sizeof(void*) with no allocation in the empty case. The
 size and capacity can be stored in the allocated region when that region
 exists. This technique can be seen in mozilla's nsTArray, libstdc++'s
 std::string (before the new ABI in gcc-5) and several other places. Like
 mozilla, I would like to use this in a tree-like structure, and a large
 proportion of the nodes are leaves with an empty vector, where 2 pointers
 make a noticable difference. To be precise, I would actually want a
 flat_set with a map-like interface (the key can be deduced from the
 value), but a vector would be a good start.

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