Skip to content

[Type-Erasure] deque: deque_basic shadow class (#3244 Tier 3H) #3250

Closed

Description

@zackees

Parent: #3244 (Phase 3 burn-down).

Goal

Mirror the fl::vector_basic / fl::flat_map_basic (#3239) / fl::unordered_map_basic (#3240) pattern for fl::deque<T>. Pull the ring-buffer arithmetic + storage management into a non-template fl::deque_basic shadow class parameterized by element size + element_ops table.

Reproduction (baseline)

bash bloat lpc845brk --example AutoResearch --top 30
# deque<char> for json + deque<u8> for parlio account for ~256 B on LPC845 today.

Acceptance

  • PR adds fl/stl/deque_basic.h + deque_basic.cpp.hpp (header + impl in unity build) following the established pattern.
  • fl::deque<T> becomes a thin templated wrapper that holds a deque_basic and an element_ops table.
  • Existing tests in tests/test_deque*.cpp pass unchanged.
  • Measured savings on LPC845-BRK / AutoResearch: ≥ 50 B net flash drop OR neutral (this is a future-proofing landing; ROI scales with future deque additions).

Design reference

Established pattern in the codebase:

FL_NO_INLINE on the implementations is load-bearing under LTO (see flat_map_basic).

Risk

  • Limited immediate ROI; primarily future-proofs the deque API for new deque instantiations that may land later.
  • Element ops table requires moving element constructor / destructor / move ops out of the templated body.

Out of scope

  • Custom allocator support beyond what deque<T> already exposes via memory_resource.

Refs #3244, #3235 (Tier 3H).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions