-
Notifications
You must be signed in to change notification settings - Fork 38.7k
util: Allow use of C++14 chrono literals #20602
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Concept ACK |
vasild
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.
ACK fa11110
If std::atomic is not involved, then
std::chrono:milliseconds foo = std::chrono::milliseconds{100};can be replaced with:
auto foo = 100ms;
|
Concept ACK. |
Yes, it is possible to change existing code, but as this is a purely stylistic change, it might be better to do it when the code is touched for other reasons. The only goal of this pull is to pull in the namespace and show that it was pulled in by replacing a few lines. |
|
Concept ACK. I've put #20253 on top of this. Will make sure to remember |
jonatack
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.
| #include <string> | ||
| #include <chrono> | ||
|
|
||
| using namespace std::chrono_literals; |
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.
trivia, both this and using namespace std::literals::chrono_literals; appear to be valid
fa11110 util: Allow use of C++14 chrono literals (MarcoFalke) Pull request description: I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is. This patch pulls in the needed namespace and replaces some lines for illustrative purposes. ACKs for top commit: vasild: ACK fa11110 jonatack: ACK fa11110 Tree-SHA512: ee2b72c8f28dee07b33b9a8ee8f7c87c0bc43b05c56a17b786cf9803ef204c7628e01b02de1af1a4eb01f5cdf6fc336f69c2833e17acd606ebda20ac6917e6bb
Summary: ``` I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is. This patch pulls in the needed namespace and replaces some lines for illustrative purposes. ``` Backport of [[bitcoin/bitcoin#20602 | core#20602]]. Ref T1696. Test Plan: ninja all check-all Build for Windows. Reviewers: #bitcoin_abc, tyler-smith Reviewed By: #bitcoin_abc, tyler-smith Subscribers: tyler-smith Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10901
I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is.
This patch pulls in the needed namespace and replaces some lines for illustrative purposes.