Boost logo

Boost :

Subject: Re: [boost] unique_ptr for C++03
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-08-12 20:17:50


> Also the commented out code works for me, but I'm basically only using the
> [] operator. For gcc 4.6 to compile its only missing the headers for if_
> and enable_if and some corresponding namespace issues. To me it looks the
> main issue is to get the boost::interprocess way of integration right.
>
> Markus Mathes

At this time it's significantly easier for me to incorporate bits from
Interprocess unique_ptr or Howard's unique_ptr into my implementation than
try to get either of these implementations to be standard compliant. I have
vetted my implementation to the standard text and it works as expected in
nearly all cases.

The main outstanding detail missing in my implementation that is solved with
Interprocess's implementation is emulating a nullptr_t (Interprocess uses a
nat*).

To get Interprocess updated to be standard compliant and use C++11 features
if available, there are quite a lot of changes required (many minor, a few
fairly large, I listed the ones I immediately found previously).

I can't think of any good methods for getting around the remaining problems
with standard compliance which no C++03 implementation I've seen solves:

1. No construction from std::auto_ptr&&. std::auto_ptr isn't marked as boost
movable, so boost::move doesn't return a BOOST_RV_REF(auto_ptr). I've pretty
much accepted this as a limitation of any C++03 implementation.

2. std::swap isn't move aware. This forces an extra requirement on
deleter_type to be copy-assignable, or use ADL swap. Again, I don't see any
way around this without introducing some non-standard mechanism for move-
aware swap.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk