Boost logo

Boost :

Subject: Re: [boost] [any] boost::get style accessors
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-04-30 07:21:54

vicente.botet wrote:
> From: "Stewart, Robert" <Robert.Stewart_at_[hidden]>
> >
> > +1 for having a common approach to extracting such values.
> > boost::get<> is consistent with tuples, not just variant, so
> > I think it is the right interface. any_cast is, of course,
> > highly specific.
> Well, tuples don't have the type as parameter, but the index
> or a tag.

Of course, but one still reaches for "boost::get<" to access the value with the suggested change, rather than something different for Boost.Any.

> In addition tuples don't need exceptions as the access is
> checked at compile time. Even if the name is the same and the
> intentions is quite close, although different, the interface
> is clearly different, so there is no advange other than using
> the same name, i.e. no possibility for generic code using both.

There is an advantage, but not as much as between Boost.Variant and Boost.Any.

> >> > So the refactoring at the interface level will introduce
> >> > constraints that sould be avoided.
> >>
> >> Could you please elaborate on your thoughts?
> >
> > I suppose that Vicente meant that this would be a breaking
> > change that he'd like to avoid, which is understandable. I
> > don't think maintaining both interfaces and explaining why
> > both exist is onerous, so that might be the best course.
> What a meant is that if any_cast is deprecated it is not
> worth to try to assocaite bag_get and bad_any_cast in any way.

Yes, if you're willing to deprecate any_cast, then bad_any_cast can go with it.

Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Boost list run by bdawes at, gregod at, cpdaniel at, john at