Note that there are some explanatory texts on larger screens.

plurals
  1. POmmap-loadable data structure library for C++ (or C)
    primarykey
    data
    text
    <p>I have a some large data structure (N > 10,000) that usually only needs to be created once (at runtime), and can be reused many times afterwards, but it needs to be loaded very quickly. (It is used for user input processing on iPhoneOS.) <code>mmap</code>-ing a file seems to be the best choice. </p> <p>Are there any data structure libraries for C++ (or C)? Something along the line</p> <pre><code>ReadOnlyHashTable&lt;char, int&gt; table ("filename.hash"); // mmap(...) inside the c'tor ... int freq = table.get('a'); ... // munmap(...); inside the d'tor. </code></pre> <p>Thank you!</p> <hr> <h2>Details:</h2> <p>I've written a similar class for hash table myself but I find it pretty hard to maintain, so I would like to see if there's existing solutions already. The library should</p> <ul> <li>Contain a <em>creation</em> routine that serialize the data structure into file. This part doesn't need to be fast.</li> <li>Contain a <em>loading</em> routine that mmap a file into read-only (or read-write) data structure that can be usable within O(1) steps of processing.</li> <li>Use O(N) amount of disk/memory space with a small constant factor. (The device has serious memory constraint.)</li> <li>Small time overhead to accessors. (i.e. the complexity isn't modified.)</li> </ul> <p>Assumptions:</p> <ul> <li>Bit representation of data (e.g. endianness, encoding of <code>float</code>, etc.) does not matter since it is only used locally.</li> <li>So far the possible types of data I need are integers, strings, and <code>struct</code>'s of them. Pointers do not appear.</li> </ul> <p>P.S. Can <a href="http://www.boost.org/doc/libs/1_42_0/doc/html/intrusive.html" rel="noreferrer">Boost.intrusive</a> help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload