Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/gfx/skia/skia/src/core/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  SkTDynamicHash.h   Sprache: C

 
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SkTDynamicHash_DEFINED
#define SkTDynamicHash_DEFINED

// This is now a simple API wrapper around THashTable<T*>;
// please just use SkTHash{Map,Set,Table} directly for new code.
#include "src/core/SkTHash.h"

// Traits requires:
//   static const Key& GetKey(const T&) { ... }
//   static uint32_t Hash(const Key&) { ... }
// We'll look on T for these by default, or you can pass a custom Traits type.
template <typename T,
          typename Key,
          typename Traits = T>
class SkTDynamicHash {
public:
    SkTDynamicHash() {}

    // It is not safe to call set() or remove() while iterating with either foreach().
    // If you mutate the entries be very careful not to change the Key.

    template <typename Fn>  // f(T*)
    void foreach(Fn&& fn) {
        fTable.foreach([&](T** entry) { fn(*entry); });
    }
    template <typename Fn>  // f(T) or f(const T&)
    void foreach(Fn&& fn) const {
        fTable.foreach([&](T* entry) { fn(*entry); });
    }

    int count() const { return fTable.count(); }

    size_t approxBytesUsed() const { return fTable.approxBytesUsed(); }

    T* find(const Key& key) const { return fTable.findOrNull(key); }

    void add(T* entry) { fTable.set(entry); }
    void remove(const Key& key) { fTable.remove(key); }

    void rewind() { fTable.reset(); }
    void reset () { fTable.reset(); }

private:
    struct AdaptedTraits {
        static const Key& GetKey(T* entry) { return Traits::GetKey(*entry); }
        static uint32_t Hash(const Key& key) { return Traits::Hash(key); }
    };
    skia_private::THashTable<T*, Key, AdaptedTraits> fTable;
};

#endif

Messung V0.5
C=91 H=100 G=95

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.