Boost logo

Boost :

Subject: Re: [boost] [multiindex] internal scope_guard has changed access from public to protected
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2010-04-24 09:09:23


Joaquin M Lopez Munoz skrev:
> Stewart, Robert <Robert.Stewart <at> sig.com> writes:
>
>> Thorsten Ottosen wrote:
>>> I'm using the scope_guard from multi_index/detail/scope_guard.hpp.
>>>
>>> It seems like a revision has made the destructor and copy-constructor
>>> protected instead of private. This is in some sense more
>> s/private/public/, I assume

Could be, I didn't check.

>>> idiomatic, but it breaks a use that I have in my upcomming
>>> auto_buffer class. Basically
>>> I'm only constructing a scope_guard object when I know the code can
>>> throw, otherwise I construct a "null" scope_guard which is simply
>>> an instance of scope_guard_impl_base.
>> Why not provide a "null" scope_guard as a first class citizen rather
>> than simply exposing implementation details to enable this use case?
>
> Yep, why can't you just define null guard as
>
> struct null_guard:boost::multi_index::detail::scope_guard_impl_base{};

the ?: operator seem to require that the second argument can be
converted to the type of the first argument.

> Unrelated to your particular problem, is this auto_buffer class
> of yours part of Boost or a private project? If the former, we
> should think about moving scope_guard to boost/detail/ where
> implementation bits common to several libs inhabit.

That's a good idea. I'm using it for an upcomming library
called Boost.AutoBuffer.

I'm confident that other boost libs also use it.

-Thorsten


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