Re: unique_ptr w/ custom deleter in header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 19, 2013 3:22 AM, "Nick"  wrote:
>
> When I use a std::unique_ptr w/ a custom deleter via an inline lambda in
> a non-template function implemented inline in a header file, I get a
> linker error.

The error you're getting is a known bug with lambdas, you can find
multiple issues like it in bugzilla.

> Note that the specifics of this example are only for demonstration
> purposes--I'm not actually trying to use a custom deleter to perform
> what the default implementation does.

It's good that it's only for demonstration because your deleters have
undefined behaviour, they mix the array form of 'new' with the
non-array 'delete'.

Usually the unique_ptr<T[]> specialization should be used for arrays.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux