Mam klasę z członkiem unique_ptr.Jak używać niestandardowego deletera z członkiem std :: unique_ptr?
class Foo {
private:
std::unique_ptr<Bar> bar;
...
};
Pasek jest klasą innej firmy, która ma funkcję create() i funkcję destroy().
Gdybym chciał użyć std::unique_ptr
z nim na samodzielny funkcji mogę zrobić:
void foo() {
std::unique_ptr<Bar, void(*)(Bar*)> bar(create(), [](Bar* b){ destroy(b); });
...
}
Czy istnieje sposób to zrobić z std::unique_ptr
jako członek klasy?
Z C++ 11 'std :: unique_ptr ptr_;' –
Joe