Boost logo

Boost Users :

From: Evan Torrie (evan.torrie_at_[hidden])
Date: 2007-06-07 17:21:17


Hi

  I'm new to Boost, and also new to Boost::Interprocess. I've been reading through the documentation for Boost::Interprocess, and have successfully written an application which creates a tree like structure in a managed_memory_mapped_file; saves it to disk, and then other processes can reopen that mmap'ed file and traverse the tree.

  However, I feel like I really am not making the best use of the library, and would like to get more experience by reading other example code from significant applications

  Does anyone have source code of a non-trivial application that exercises shared memory or memory-mapped files, storing objects with pointers to other objects (and strings) into the shared memory, deleting, updating, retrieving them etc.

  Specifically, say I'm trying to port an existing heap-based structure into shared memory.

struct foo {
  int x, y;
  std::vector< std::string > keys;
  struct foo* left, right;
}

struct foo* root;

  What would this translate to in the boost::interprocess world? Is it possible to write templatized versions of these data structures that would work either with the existing std::allocator heap-based memory or with boost::interprocess stateful allocators without needing to create two versions of this data structure?
  One problem I've encountered is that default constructors for boost::interprocess::vector/string etc are not possible since they need to be constructed with a stateful allocator... so, does this mean that any constructor for object foo requires an allocator to be passed in which is then used in the initializer list to initialize these member containers?

  Sorry if this doesn't make sense - but any help would be appreciated.

Thanks
Evan.
 
-----------------------------------------
E> evan.torrie_at_[hidden]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net