Questions tagged [custom-deleter]
2 questions
2
votes
1 answer
How to create an array of unique_ptrs with custom deleters?
Here's what I have:
Demo
#include
#include
#include
#include
#include
#include /* declval */
struct msg_outbound_t
{
std::string_view hello_ = "Hello World!";
};
// Default…

glades
- 3,778
- 1
- 12
- 34
1
vote
1 answer
Can't constuct a std::unique_ptr with a lambda as a custom deleter
I am trying to declare std::unique_ptr with a custom deleter:
using FILE = int;
FILE *f = nullptr;
std::unique_ptr pf(f, [](FILE *f) {});
but without a success. What is wrong?
How to use a lambda as a deleter? Do I really need decltype?
MSVC…

Alexey Starinsky
- 3,699
- 3
- 21
- 57