Skip to content

replace QHashIterator with QMultiHash::cbegin/cend#4377

Merged
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qmultihash_iterator
Oct 12, 2021
Merged

replace QHashIterator with QMultiHash::cbegin/cend#4377
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qmultihash_iterator

Conversation

@Be-ing
Copy link
Copy Markdown
Contributor

@Be-ing Be-ing commented Oct 12, 2021

QMultiHash is not a subclass of QHash in Qt6:
https://doc.qt.io/qt-6/qtcore-changes-qt6.html#removal-of-qhash-insertmulti
so the
QHashIterator(const QHash<Key, T> &hash)
constructor cannot be used with QMultiHash.

QHashIterator<SoundDeviceId, AudioOutput> it(outputs);
while (it.hasNext()) {
it.next();
auto hash = config.getOutputs();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • hash is not an appropriate variable name, how about outputDeviceMap?
  • const auto

QHashIterator<SoundDeviceId, AudioInput> it(inputs);
while (it.hasNext()) {
it.next();
auto hash = config.getInputs();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • hash is not an appropriate variable name, how about inputDeviceMap?
  • const auto

@Be-ing Be-ing force-pushed the qmultihash_iterator branch from cc3b6d7 to a04b838 Compare October 12, 2021 08:32
QHashIterator<SoundDeviceId, AudioInput> it(inputs);
while (it.hasNext()) {
it.next();
const auto inputDeviceHash = config.getInputs();
Copy link
Copy Markdown
Contributor

@uklotzde uklotzde Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually this is still a key/value "map". It doesn't matter if it is a tree or a hash map. This is an implementation detail.

The term "hash" usually means hash code or value and not hash map when used standalone.

If we want to reference the underlying data structure in the naming then inputDeviceMap.

@Be-ing Be-ing force-pushed the qmultihash_iterator branch from a04b838 to 03b18ee Compare October 12, 2021 18:23
QMultiHash is not a subclass of QHash in Qt6:
https://doc.qt.io/qt-6/qtcore-changes-qt6.html#removal-of-qhash-insertmulti
so the
QHashIterator(const QHash<Key, T> &hash)
constructor cannot be used with QMultiHash.
@Be-ing Be-ing force-pushed the qmultihash_iterator branch from 03b18ee to b428f48 Compare October 12, 2021 18:31
@Be-ing Be-ing requested a review from uklotzde October 12, 2021 21:48
Copy link
Copy Markdown
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM

@uklotzde uklotzde merged commit 8049b96 into mixxxdj:main Oct 12, 2021
@Be-ing Be-ing deleted the qmultihash_iterator branch October 12, 2021 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants