Skip to content

Instantly share code, notes, and snippets.

@marijanp
Last active January 26, 2022 11:31
C++ notes

Dealing with raw pointers

int facory_function(Type *t);

int main (int argc, char *argv[]) {
  const std::unique_ptr<Type> t_ptr{ [] {
    Type *t = nullptr;
    if (factory_function(t)) {
      return t;
    }
    else {
      return t;
    }
  } ()};
  
  return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment