Repository navigation
feat(seq): template MessageSeq on the container, like StringSeq - #117
Merged
Merged
Conversation
MessageSeq was templated on the ELEMENT and held std::vector<T> *out, i.e. the destination was hard-wired. StringSeq is templated on the CONTAINER and holds C &out, which is why it already serves both storage profiles. This brings MessageSeq to the same shape, so it can collect into an InlineVector<T, N> as well as a std::vector. That is the prerequisite for generated C++ dropping its own sofabgen::WrapperSeq: the static-storage profiles instantiate it as WrapperSeq<sofab::InlineVector<Elem, N>>, which the element-templated MessageSeq could not express — which is also why MessageSeq was emitted zero times and WrapperSeq was emitted instead (generator#345). The old spelling keeps working. detail::namesSeqContainer() tells the two readings apart from the argument alone: an argument names a container when its value_type is something this collector reads as an element. The two can only collide for an element that is itself a sequence of messages or a row of rows, and under the element reading such an element goes to IStreamImpl::read, which has no overload for it — so what the container reading takes over is code that never compiled. Closes #116.
Merged
Andste82
added a commit
that referenced
this pull request
Sep 24, 2026
The git tag is the source of truth for the version; this brings every package manifest in line with the v0.11.0 tag that follows. Since v0.10.0 this library changes wire output (#99: trailing default array elements stay on the wire; #104: arrays and payloads past the §6.2 format ceiling are refused) and public API (#77, #76, #127/#128, #135, #117). Both are breaking under the pre-1.0 rule that a minor bump may break API or wire output, hence 0.10 -> 0.11. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #116. The prerequisite for generated C++ dropping
sofabgen::WrapperSeq.The change
MessageSeqwas templated on the element and heldstd::vector<T> *out—the destination was hard-wired.
StringSeqis templated on the container andholds
C &out, which is why it already serves both storage profiles. This bringsMessageSeqto the same shape, so it can collect into anInlineVector<T, N>aswell as a
std::vector.That is exactly what generated code needs: the static-storage profiles
instantiate their own collector as
WrapperSeq<sofab::InlineVector<Elem, N>>,which the element-templated
MessageSeqcould not express — which is also whyMessageSeqwas emitted zero times whileWrapperSeqwas emitted instead(sofa-buffers/generator#345).
The old spelling keeps working
detail::namesSeqContainer()tells the two readings apart from the argumentalone: an argument names a container when its
value_typeis something thiscollector reads as an element (a message, or a row container). The readings can
only collide for an element that is itself a sequence of messages or a row of
rows — and under the element reading such an element is handed to
IStreamImpl::read, which has no overload for it. So what the container readingtakes over is code that never compiled.
CappedMsgin the test file still usesMessageSeq<SeqRow>and is exercised as before.Tests
Header-only, so built directly with g++ 15.2 (
-std=c++20), no cmake in thisenvironment:
test_roundtrip.cpptest_roundtrip.cppwith-DSOFAB_STRICT_UTF8=0test_vectors.cppagainstassets/test_vectors.jsoninvalid_utf8vectorsOne fix to a new test
"the rejected element is never allocated for"failed as written. Thedestination was correctly empty, but the allocation counter was captured at the
top of the block — before the decoder and the wire vector were constructed — so
it counted four setup allocations and would have passed or failed on setup rather
than on the rejected element. Moved the capture to just before
feed, matchingthe neighbouring
bound-vs-capcase that does the same thing. With it, theassertion tests what it says and passes.
Provenance
Written by a subagent that could not build, test or push — every shell call in its
session was refused by a worktree-isolation guard — so it left the work
uncommitted in the checkout. This picks it up, runs the suites it never got to
run, fixes the one failure that surfaced, and opens the PR.
Part of sofa-buffers/generator#345.