Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork137
Added stream insertion operator.#181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codecov-commenter commentedFeb 6, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #181 +/- ##==========================================- Coverage 95.70% 95.57% -0.14%========================================== Files 13 16 +3 Lines 954 1084 +130 ==========================================+ Hits 913 1036 +123- Misses 41 48 +7 ☔ View full report in Codecov by Sentry. |
aentinger commentedFeb 7, 2023
Hi@jfjlaros ☕ 👋 Thank you for your contribution. It should still be comparatively easy to add test code within the Frankly, I'm not going to approve the API in its current state, makePair just sounds way to similar to std::pair, but has a completely different effect. That's going to throw people for sure. |
jfjlaros commentedFeb 7, 2023
I will have a look at the unit tests.
Hmm. I could add a second constructor to Serial << Pair(1.2,4) <<'' << Pair(12, BIN) <<"\r\n"; then the function |
aentinger commentedFeb 7, 2023
Well yes. So why re-invent |
jfjlaros commentedFeb 7, 2023
Because the standard template library is not available, or is this not the case for cores that depend on this repository? I could make something more specialised I guess. |
5993485 to4944f85Comparejfjlaros commentedFeb 7, 2023
The unit tests seem to fail because of a failed upload in the workflow. Perhaps someone could re-trigger it. |
jfjlaros commentedFeb 7, 2023
Thanks@per1234. @aentinger, I followed your suggestions and updated the PR. I guess now the description should be as follows. In this PR, the following is added:
Usage: int a {9};int b {10};Serial <<"You have" << a <<" out of" << b <<" retries left.\r\n";// Prints: "You have 9 out of 10 retries left."Serial << format(1.2,4) <<'' << format(12, BIN) <<"\r\n";// Prints: "1.2000 1100" |
jfjlaros commentedFeb 7, 2023
Hmm, same problem with the failed upload again... |
per1234 commentedFeb 7, 2023
I apologize for the inconvenience@jfjlaros. Unfortunately these spurious failures caused by transient network faults are a common occurrence when using GitHub Actions. I reran the job and it passed this time. |
aentinger left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the test code, still needs some improvements ;)
Uh oh!
There was an error while loading.Please reload this page.
aentinger commentedFeb 8, 2023
|
b378a21 to47f61b9Comparematthijskooijman commentedFeb 8, 2023
I'm aware that at least AVR does not support it, I think most if not all other cores do have it. For AVR, this might be solveable by enabling libstdc++, seearduino/toolchain-avr#89 about this (this is off-topic for this PR, but I wanted to mention it here in case it is interesting to anyone here). |
jfjlaros commentedFeb 8, 2023
That would be great, I have my own implementations of |
jfjlaros commentedAug 1, 2023
Perhaps the "Changes requested" block can be resolved (as all the underlying requests have been addressed)? |
aentinger left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This change looks good to me.
However, we likely need approval from the gatekeepers of the Arduino API.
@facchinm, do you have any recommendations on how we should proceed?
PaulStoffregen commentedAug 8, 2023
Has anyone considered the impact of a global scope function named "format" and a global scope class named "Format" on the existing Arduino ecosystem? Will these cause some programs and libraries to break? |
jfjlaros commentedAug 8, 2023
Probably, I find it hard to tell. We could simply rename them or not introduce them into the global scope at all. I would prefer the latter. |
jfjlaros commentedJan 19, 2024
I have removed both the |
safocl commentedJan 31, 2025
Can it return a |
Uh oh!
There was an error while loading.Please reload this page.
In this PR, an implementation of
Pair(analogous tostd::pair), a helper function to create aPairand twoStreaminsertion operators are added.The basic
Streaminsertion operator allows for compact and convenient writing to aStream. An overload is provided to allow for modifiers likeBIN,HEXand the number of digits.Usage:
Thisfixes#180.