You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[C++] Port access order checking tests and implementation to C++.
In this commit, I also addressed these issues (1-3):
--- 1. Tidy up string format usage. ---
For convenience and readability, I had inlined some concatenation into
`string.format(...)` templates; however, this makes it unclear whether
the variable/method-output being concatenated uses template parameters.
Therefore, I have adjusted to inject these strings via template
parameters. FWIW I'd prefer to use `StringBuilder` everywhere, as I
think it is hard to read large string format templates.
--- 2. Explcitly delete copy constructors of flyweights. ---
I found it easy to accidentally write sub-optimal code where I relied on
copy constructors. For example:
```
MyMessage::MyGroup myGroup = myMessage.myGroup(10);
```
rather than:
```
MyMessage::MyGroup &myGroup = myMessage.myGroup(10);
```
Copying semantics are a bit strange when it comes to flyweights and
trees of flyweights. Therefore, I think it is best to avoid entirely.
This change is behind a feature flag. To re-enable implicit copy
constructors specify the system property
`-Dsbe.generate.implicit.copy.constructors=true`.
--- 3. Adjust state machines to allow repeated decoding of variable-length ---
data lengths, as accesses do not advance `limit`.
0 commit comments