Boost logo

Boost :

Subject: Re: [boost] [proposal] safe_ref<T>
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-12-13 02:18:01


On 13 December 2012 01:05, Andrey Semashev <andrey.semashev_at_[hidden]>wrote:

> I don't see how this is better than optional<T&>, sorry. Your Safe
> wrapper could have been written around optional with the same success,
> and using lambdas or other function objects to work with references
> seem overcomplicated to me.

+1

> optional<int&> si(temp)
> if (si)
> std::cout << *si << std::endl;
>

Or even:

int* pi(&temp);
if (pi)
    std::cout << *pi << std::endl;

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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