INNER CODE UNIT · C++

d

torognes/swarm · src/algod1.cpp:97

       at d=2) */
    auto push(unsigned int const amp) noexcept -> void {
      assert(used_ < storage().size());  // reserve_for() precedes the writes
      storage()[used_] = amp;
      ++used_;
    }

    /* the hits collected so far, mutable because the caller sorts them in
       place. Invalidated by any later push() that grows the storage. */
    auto filled() noexcept -> Span<unsigned int> {
      return make_span(storage()).first(used_);
    }

  private:
    /* a reference_wrapper rather than a plain 'std::vector<unsigned int> &':
       a reference member would delete the assignment operator, which is what
       cppcoreguidelines-avoid-const-or-ref-data-members reports. The borrow
       is unchanged -- the caller still owns the storage -- and storage()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…