You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike std::make_unique which does not allow the passing of a custom deleter, this factory does. A deleter whose construction can throw would leak like in the following contrived test case:
int x = 1;
struct S {
S () { throw 0; }
void operator() (int) const { x = 0; }
};
int main () {
try {
stdx::make_unique_resource_checked (x, 0, S{ });
}
catch (...) {
assert (0 == x);
}
return 0;
}
The assertion fails. One could amend the specification to ask that the deleter construction doesn't throw, along the lines of a similar specification for the deleter of std::unique_ptr (e.g., 32.11.1.2.1p5). Is this something that popped up in the previous discussions you had in LWG?
The text was updated successfully, but these errors were encountered:
Unlike
std::make_unique
which does not allow the passing of a custom deleter, this factory does. A deleter whose construction can throw would leak like in the following contrived test case:The assertion fails. One could amend the specification to ask that the deleter construction doesn't throw, along the lines of a similar specification for the deleter of
std::unique_ptr
(e.g., 32.11.1.2.1p5). Is this something that popped up in the previous discussions you had in LWG?The text was updated successfully, but these errors were encountered: