Skip to content

Instantly share code, notes, and snippets.

@atimin
Created September 20, 2020 19:31
Show Gist options
  • Save atimin/c8b2f77c44c5e200819e14fa34d13910 to your computer and use it in GitHub Desktop.
Save atimin/c8b2f77c44c5e200819e14fa34d13910 to your computer and use it in GitHub Desktop.
class A {
 public:
  A() { is_valid_ = Init(); };
  void Foo() {
  if (!is_valid_) {
  is_valid_ = Init()
  }
  // do work 
 }
 
private:
  bool Init() { /* get some resources */ }
  bool is_valid_
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment