Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <memory>
- using namespace std;
- class A {
- public:
- unique_ptr<int> data;
- A(int *d) : data(d) {
- throw runtime_error("error");
- }
- };
- class B {
- public:
- unique_ptr<int[]> data2;
- unique_ptr<A> a;
- B() : data2(new int[10]),
- a(new A(new int(5))) {
- }
- //~B() = default;
- };
- int main() {
- try {
- B b;
- }
- catch (exception) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement