Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with no exceptionsafetyguarantee
From: Nevin Liber (nevin_at_[hidden])
Date: 2010-10-22 17:01:21


On 22 October 2010 14:09, Daniel Walker <daniel.j.walker_at_[hidden]> wrote:
> To make the example
> portable, you need to add a destructor to S1.

Why?

> struct S1 {
>    ~S1() {}
>    void operator()() {}
>    void* operator new(std::size_t, void* p)
>    {
>        // throw on third alloc
>        if(++i == 3)
>            throw std::bad_alloc();
>        return p = ::new S1();
>    }
> };

-- 
 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