summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-02-11 23:24:13 +0100
committerGitHub <[email protected]>2021-02-11 23:24:13 +0100
commit06446ac73cf8c5daaebc72be05ce606f4c7d1a2b (patch)
treea2cb6b667ccb5f939bd8c8a7205dba0af6e88a9a
parent6427626639f37c142b225c998888dfbe9be1328c (diff)
downloadSTC-modified-06446ac73cf8c5daaebc72be05ce606f4c7d1a2b.tar.gz
STC-modified-06446ac73cf8c5daaebc72be05ce606f4c7d1a2b.zip
Update README.md
-rw-r--r--README.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9eaeafff..a38a402e 100644
--- a/README.md
+++ b/README.md
@@ -208,4 +208,6 @@ FAQ
- **A**: Many reasons. It uses open addressing which holds all buckets in one block of memory. It uses a separate array for precomputed hashes/used buckets - only one byte per bucket. It avoids modulus operations and erases elements without leaving tombstones. Modern architechtures favors simple code and cached memory access, so linear probing is actually as fast or faster than the more advanced Robin Hood and Hopscotch hashing schemes, and they require tombstones. **cmap** does not rely on wasteful power-of-two array sizes, it actually expands only by 1.5x when required.
- **Q**: How come **cvec_str_emplace_back()** can take a `const char *` argument, when its value type `cstr` cannot be directly assigned from a `const char *`?
-- **A**: STC containers simulates automatic type convertion found in c++. All containers can take an optional "rawvalue" type as template parameter in the **using_**-declaration, along with back and forth convertion methods to the container value type. By default, rawvalue is equal to value. Various **emplace()**, **cmap_put()** and lookup methods accepts the rawvalue type, which is convenient e.g. for strings. But also map insertions, because values are only conditionally inserted to maps. The **emplace()** method construct the cstr object from a rawvalue only when needed. **using_cvec_str()** declares `cvec_str` container type with predefined `cstr` value and `const char *` rawvalue, along with convertion methods.
+- **A**: STC containers simulates automatic type convertion found in c++. All containers can take an optional "rawvalue" type as template parameter in the **using_**-declaration, along with back and forth convertion methods to the container value type. By default, rawvalue is equal to value. Various **emplace()**, **cmap_put()** and lookup methods accepts the rawvalue type, which is convenient e.g. for strings.
+
+It is also useful for map insertions, because values are only conditionally inserted - the **emplace()** method construct a cstr object from a rawvalue only when needed. **using_cvec_str()** declares `cvec_str` container type with predefined `cstr` value and `const char *` rawvalue, along with convertion methods.