Comment

Comment by millimeterman

While we're doing code review, in general there's no reason to pass a shared_ptr, even by const ref, unless you need to (e.g. if you might copy the shared_ptr within the function). It's better to pass a raw pointer to indicate that the function only requires a temporary non-owning view into the data.

  static int add_numbers(Data *p) {
      return p->a + p->b;
  }

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton