[Boost-bugs] [Boost C++ Libraries] #11046: Boost.Any allocator support RFC

Subject: [Boost-bugs] [Boost C++ Libraries] #11046: Boost.Any allocator support RFC
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-18 14:50:40


#11046: Boost.Any allocator support RFC
------------------------------+---------------------
 Reporter: gonzalobg88@… | Owner: nasonov
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: any
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 Right now it is possible to use Boost.Any with types that require special
 alignment (sse intrinsics, Eigen3 data types, ...) by overriding the
 global operators new and delete. This solution is far from optimal, since
 it results in everything in the whole program being overaligned.

 I'm opening this Request For Comments to discuss a possibly better
 solution to this problem.

 The gist of the idea is for Boost.Any to store a polymorphic allocator (of
 possibly zero size), such that the user can provide an allocator when
 initializing/assigning/copying an any object.

 This increases the API of Boost.Any (changes proposed below). It also
 decreases its performance, since allocating/deallocating memory would
 incur an extra virtual function call. It might also increase the size of
 the any object. One has, however, to consider the impact of the current
 workarounds in larger programs. Over-aligning all allocations might have a
 larger impact on performance and memory footprint than the proposed
 changes.

 I think the following interface should be enough:

 - any(polymorphic_allocator allocator = default_allocator());

 - any(const any &, polymorphic_allocator allocator = default_allocator());

 - any(any &&, polymorphic_allocator allocator = default_allocator());

  - template<typename ValueType>
    any(const ValueType &, polymorphic_allocator allocator =
 default_allocator());

 - template<typename ValueType>
   any(ValueType &&, polymorphic_allocator allocator =
 default_allocator());

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