Refactor open date range to use std::optional#354
Merged
Conversation
c4095ce to
a7837ba
Compare
Member
|
Concept ACK |
Member
|
nit: include |
a7837ba to
4830f49
Compare
Talkless
approved these changes
Aug 11, 2021
| QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime(); | ||
| if (datetime < dateFrom || datetime > dateTo) | ||
| return false; | ||
| if (dateFrom && datetime < *dateFrom) return false; |
There was a problem hiding this comment.
std::optional does support comparison without dereferencing (see (26) in https://en.cppreference.com/w/cpp/utility/optional/operator_cmp) but your variant is better as operator< would repeat if (opt) check you already (rightly) did.
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Aug 15, 2021
…onal 4830f49 qt: Refactor open date range to use std::optional (João Barbosa) Pull request description: Use `std::nullopt` for open date range instead of `TransactionFilterProxy::MIN_DATE` and `TransactionFilterProxy::MAX_DATE`. ACKs for top commit: hebasto: re-ACK 4830f49, only missed header included since my [previous](bitcoin-core/gui#354 (review)) review. Talkless: tACK 4830f49, tested on Debian Sid, filtering seems to work as expected. Tree-SHA512: dcecbcc129cb401d6ac13a20f015b8cb2a7434fae6bd3e5b19fca5531e8bd915e2a0835f9c601371381750cdc8cd6fcf4f8c6669177d679773046cbe13bed68b
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Use
std::nulloptfor open date range instead ofTransactionFilterProxy::MIN_DATEandTransactionFilterProxy::MAX_DATE.