ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

deque-like ? Insert an element in a fixed-length range. #1739

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello,

I would like to know if it's possible to recreate the logic of deque using this library.

My main issue is the non growable constraint: the allocated memory is fixed.

The main elements needed are a pointer to an already allocated non growable range of memory given by the user, a pointer to the beginning of the range (which can differ from the actual beginning of the range), and same thing for the end.

Inserting an element should never go beyond the allocated memory or it should throw or return false;

At the core level, it is basically inserting, removing and updating pointers, but unsure how to deal with the fixed size constraint.

Thanks

ghost commented 1 year ago

The solution comes with rotate