Function CE::Memory::adjust_length

Function Documentation

inline std::size_t CE::Memory::adjust_length(std::size_t length, FitPolicy fit, std::size_t gb, double gf)

Computes a capacity request without allocating storage.

Parameters:
  • length – Requested length in caller-defined units.

  • fit – exact/unknown retain length; larger adds gb; greedy truncates gf*length then adds gb.

  • gb – Fixed growth margin in the same units as length.

  • gf – Finite positive multiplier, consulted only for greedy growth.

Throws:

CE::Exceptions::bad_request – For invalid greedy factors or growth overflow.

Returns:

Adjusted, representable length; it need not describe actual allocated capacity.