43for (
int i = 0;
i < 1000; ++
i) {
44 if (
hash[
i] == okButton)
45 cout <<
"Found button at index " <<
i << endl;
51QHashIterator<QString, int>
i(
hash);
54 cout <<
qPrintable(
i.key()) <<
": " <<
i.value() << endl;
99 && e1.dateOfBirth() == e2.dateOfBirth();
114for (
int i = 0;
i < 20000; ++
i)
123while (
i != objectHash.
end() &&
i.key() ==
obj) {
124 if (
i.value() == 0) {
137while (
i !=
hash.
end() &&
i.key() ==
"HDR") {
138 cout <<
i.value() <<
endl;
149hash.insert(
"December", 12);
167if (
i.key() ==
"Hello")
168 i.value() =
"Bonjour";
177hash.insert(
"December", 12);
187hash1.
insert(
"plenty", 100);
188hash1.
insert(
"plenty", 2000);
191hash2.
insert(
"plenty", 5000);
194hash3 = hash1 + hash2;
208while (
i !=
hash.
cend() &&
i.key() ==
"plenty") {
209 cout <<
i.value() <<
endl;
216 cout <<
"The key: " <<
it.key() <<
endl;
225int numPrimes = std::count_if(
keys.cbegin(),
keys.cend(), isPrimeNumber);
234inline size_t qHash(
const std::vector<int> &
key,
size_t seed = 0)
244inline size_t qHash(
const std::vector<int> &
key,
size_t seed = 0)
251inline size_t qHash(
const std::unordered_set<int> &
key,
size_t seed = 0)
275template <>
struct hash<K>
278 size_t operator()(
const K &
key,
size_t seed = 0)
const;
QString name() const
[5] //! [6]
\inmodule QtCore \reentrant
key_iterator keyEnd() const noexcept
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator cbegin() const noexcept
const_iterator constFind(const Key &key) const noexcept
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
void reserve(qsizetype size)
Ensures that the QHash's internal hash table has space to store at least size items without having to...
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
iterator erase(const_iterator it)
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
key_iterator keyBegin() const noexcept
T value(const Key &key) const noexcept
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
const_iterator cend() const noexcept
QHash() noexcept=default
Constructs an empty hash.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QHash< int, QWidget * > hash
[35multi]
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
qsizetype erase_if(QByteArray &ba, Predicate pred)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
size_t qHashBits(const void *p, size_t size, size_t seed) noexcept
size_t qHashRange(InputIterator first, InputIterator last, size_t seed=0) noexcept(noexcept(qHash(*first)))
size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed=0) noexcept(noexcept(qHash(*first)))
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
GLenum GLsizei GLsizei GLint * values
[15]
GLbitfield GLuint64 timeout
[4]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
#define qPrintable(string)