Subject: [Boost-bugs] [Boost C++ Libraries] #12763: Provide a way to specify a default disposer
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-16 07:19:18
#12763: Provide a way to specify a default disposer
------------------------------+--------------------------
Reporter: fdegros@⦠| Owner: igaztanaga
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: intrusive
Version: Boost 1.63.0 | Severity: Optimization
Keywords: |
------------------------------+--------------------------
It would be convenient if there was a way to specify a default disposer to
be applied to elements stored in an intrusive container. This would make
it easier to write containers that take ownership of their inserted
elements.
This would impact the container's destructor as well as the methods
{{{erase}}}, {{{erase_after}}}, {{{clear}}}, {{{remove}}},
{{{remove_if}}}, {{{pop_front}}}, {{{pop_back}}}, {{{assign}}},
{{{unique}}} and {{{clone_from}}}.
The library should probably provide a no-op disposer, which would be the
default one used by intrusive containers. Particular care should be taken
in {{{clear}}} and containers' destructors in order to avoid calling the
no-op disposer for every element.
For example:
{{{
boost::intrusive::list<MyElement,
boost::intrusive::disposer<std::default_delete<MyElement>>> elems;
elems.insert(*new MyElement);
// Clearing the collection deletes the elements.
elems.clear();
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12763> 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:20 UTC