jank icon indicating copy to clipboard operation
jank copied to clipboard

Consider moving `fresh_seq` to `sequenceable_in_place`

Open frenchy64 opened this issue 10 months ago • 2 comments

fresh_seq is only meaningful implement alongside next_in_place, which is in sequenceable_in_place.

frenchy64 avatar Feb 15 '25 00:02 frenchy64

Thought more about this. sequenceable_* is meant for sequences, where as fresh_seq is meant for seqables. We could have both seqable and seqable_in_place, but every seqable should be seqable in place. So, not sure if moving this makes sense.

Maybe it makes more sense to move next_in_place back into sequenceable.

jeaye avatar Feb 21 '25 00:02 jeaye

Maybe it makes more sense to move next_in_place back into sequenceable.

Yeah probably. We can get rid of this template and delegate to implementations.

  template <typename T>
  requires(behavior::sequenceable<T> && !behavior::sequenceable_in_place<T>)
  auto next_in_place(native_box<T> const s)
  {
    /* Not all sequences can be updated in place. For those, just gracefully
     * do a normal next. */
    return s->next();
  }

frenchy64 avatar Feb 21 '25 06:02 frenchy64