Boost logo

Boost :

Subject: Re: [boost] [multiindex] internal scope_guard has changed access from public to protected
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2010-04-24 08:04:08


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
>
> > 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{};

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.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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