ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
TableSize.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*---------------------------- File TableSize.h ----------------------------*/
3
/*--------------------------------------------------------------------------*/
28
/*--------------------------------------------------------------------------*/
29
/*----------------------------- DEFINITIONS --------------------------------*/
30
/*--------------------------------------------------------------------------*/
31
32
#ifndef __ADS_TableSize
33
#define __ADS_TableSize
34
/* self-identification: #endif constant */
35
36
/*--------------------------------------------------------------------------*/
37
/*------------------------------ INCLUDES ----------------------------------*/
38
/*--------------------------------------------------------------------------*/
39
40
#include "
ADS/Contract.h
"
41
42
#include <algorithm>
43
#include <concepts>
44
#include <cstddef>
45
46
/*--------------------------------------------------------------------------*/
47
/*--------------------------- NAMESPACE ------------------------------------*/
48
/*--------------------------------------------------------------------------*/
49
50
namespace
ADS
51
{
52
53
/*--------------------------------------------------------------------------*/
54
/*-------------------------------- HELPERS ---------------------------------*/
55
/*--------------------------------------------------------------------------*/
56
58
bool
is_prime
( std::size_t n );
59
61
std::size_t
next_prime
( std::size_t n );
62
65
bool
is_pow2
( std::size_t n );
66
85
std::size_t
resized
( std::size_t m ,
bool
grow , std::size_t m0 );
86
95
template
<
class
H ,
class
K >
96
concept
PlaceHash
=
requires
(
const
H & h ,
const
K & k , std::size_t m )
97
{
98
{ h.place( k , m ) } -> std::convertible_to< std::size_t >;
99
};
100
101
/*--------------------------------------------------------------------------*/
102
103
}
// end( namespace ADS )
104
105
/*--------------------------------------------------------------------------*/
106
/*-------------------------- IMPLEMENTATION --------------------------------*/
107
/*--------------------------------------------------------------------------*/
108
109
#include "ADS/dictionary/impl/TableSize.tpp"
110
111
/*--------------------------------------------------------------------------*/
112
113
#endif
/* TableSize.h included */
114
115
/*--------------------------------------------------------------------------*/
116
/*-------------------------- End File TableSize.h --------------------------*/
117
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::PlaceHash
a hash that maps a key straight to a place of a table of places by h.place( k , m ),...
Definition
TableSize.h:96
ADS::is_pow2
bool is_pow2(std::size_t n)
true if is a power of two, i.e., and n & ( n - 1 ) is 0
ADS::resized
std::size_t resized(std::size_t m, bool grow, std::size_t m0)
the size after a doubling, or after a halving down to
ADS::is_prime
bool is_prime(std::size_t n)
true if is prime, by trial division up to
ADS::next_prime
std::size_t next_prime(std::size_t n)
the smallest prime not smaller than , by trial divisions
ADS
Definition
ADT.h:96
ADS
dictionary
TableSize.h
Generated by
1.17.0