Skip to content

Instantly share code, notes, and snippets.

@geniys
Last active May 25, 2016 02:00
Show Gist options
  • Save geniys/3259fbd6b08063c6b0b3ea3f11688ea3 to your computer and use it in GitHub Desktop.
Save geniys/3259fbd6b08063c6b0b3ea3f11688ea3 to your computer and use it in GitHub Desktop.

Link

C++ FAQ

Catch exception from constructor initializer list

// foo.h
class Foo {
public:
  Foo();
private;
  Bar mBar;
}

// foo.cpp
class Foo::Foo() try : mBar() {
  // constructor
} catch ( ... ) {
  // handle exception
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment