cds  2.3.3
cds::container::feldman_hashset::traits Struct Reference

FeldmanHashSet traits More...

#include <cds/container/details/feldman_hashset_base.h>

Public Types

typedef cds::opt::none hash_accessor
 Mandatory functor to get hash value from data node. More...
 
typedef cds::opt::none hash_splitter
 Hash splitter. More...
 
typedef cds::opt::none compare
 Hash comparing functor. More...
 
typedef cds::opt::none less
 Specifies binary predicate used for hash compare. More...
 
typedef cds::atomicity::item_counter item_counter
 Item counter. More...
 
typedef CDS_DEFAULT_ALLOCATOR allocator
 Item allocator. More...
 
typedef CDS_DEFAULT_ALLOCATOR node_allocator
 Array node allocator. More...
 
typedef cds::opt::v::relaxed_ordering memory_model
 C++ memory ordering model. More...
 
typedef cds::backoff::Default back_off
 Back-off strategy.
 
typedef empty_stat stat
 Internal statistics. More...
 
typedef cds::opt::v::rcu_throw_deadlock rcu_check_deadlock
 RCU deadlock checking policy (only for RCU-based FeldmanHashSet) More...
 

Static Public Attributes

static constexpr size_t const hash_size = 0
 The size of hash value in bytes. More...
 

Detailed Description

Member Typedef Documentation

Hash comparing functor.

No default functor is provided. If the option is not specified, the less option is used.

Mandatory functor to get hash value from data node.

It is most-important feature of FeldmanHashSet. That functor must return a reference to fixed-sized hash value of data node. The return value of that functor specifies the type of hash value.

Example:

typedef uint8_t hash_type[32]; // 256-bit hash type
struct foo {
hash_type hash; // 256-bit hash value
// ... other fields
};
// Hash accessor
struct foo_hash_accessor {
hash_type const& operator()( foo const& d ) const
{
return d.hash;
}
};

Hash splitter.

This trait specifies hash bit-string splitter algorithm. By default, cds::algo::number_splitter is used if HashType is a number, cds::algo::split_bitstring otherwise.

Item counter.

The item counting is an important part of FeldmanHashSet algorithm: the empty() member function depends on correct item counting. Therefore, atomicity::empty_item_counter is not allowed as a type of the option.

Default is atomicity::item_counter. To avoid false sharing you can aldo use atomicity::cache_friendly_item_counter

Specifies binary predicate used for hash compare.

If less and compare are not specified, memcmp() -like bit-wise hash comparator is used because the hash value is treated as fixed-sized bit-string.

C++ memory ordering model.

Can be opt::v::relaxed_ordering (relaxed memory model, the default) or opt::v::sequential_consistent (sequentially consisnent memory model).

Array node allocator.

Allocator for array nodes. The allocator is used for creating headNode and arrayNode when the set grows. Default is CDS_DEFAULT_ALLOCATOR

Internal statistics.

By default, internal statistics is disabled (feldman_hashset::empty_stat). Use feldman_hashset::stat to enable it.

Field Documentation

constexpr size_t const cds::container::feldman_hashset::traits::hash_size = 0
static

The size of hash value in bytes.

By default, the size of hash value is sizeof( hash_type ). Sometimes it is not correct, for example, for that 6-byte struct static_assert will be thrown:

struct key_type {
uint32_t key1;
uint16_t subkey;
};
static_assert( sizeof( key_type ) == 6, "Key type size mismatch" );

For that case you can specify hash_size explicitly.

Value 0 means sizeof( hash_type ).


The documentation for this struct was generated from the following file:

cds 2.3.3 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Apr 5 2026 09:49:56 by Doxygen 1.8.10