Hacker News new | ask | show | jobs
by niekb 1422 days ago
The author could compile c++ with the sanitizers, i.e. -fsanitize=address,undefined and make a make_appender function that leverages perfect forwarding...:

  template<typename S>
  auto make_appender(S&& suffix)
  {
    return [perf_fwd_suffix = std::tuple{std::forward<S>(suffix)}](std::vector<int>&& items)
    {
        return append(std::move(items), std::get<0>(perf_fwd_suffix));
    };
  }
see: https://godbolt.org/z/M9P4MK4a8