Simplify doc_/comp_ examples using quickbook macros instead of in-code #ifdefs.

This commit is contained in:
Ion Gaztañaga
2024-08-05 00:39:23 +02:00
parent 86855f7c70
commit 6be5872ef7
41 changed files with 74 additions and 692 deletions

View File

@@ -7,8 +7,9 @@
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#if defined(BOOST_INTERPROCESS_MAPPED_FILES)
#include <boost/interprocess/detail/workaround.hpp>
#if defined(BOOST_INTERPROCESS_MAPPED_FILES)
//[doc_managed_multiple_allocation
#include <boost/interprocess/managed_shared_memory.hpp>
@@ -29,31 +30,14 @@ int main()
//Remove shared memory on construction and destruction
struct shm_remove
{
//<-
#if 1
shm_remove() { shared_memory_object::remove(test::get_process_id_name()); }
~shm_remove(){ shared_memory_object::remove(test::get_process_id_name()); }
#else
//->
shm_remove() { shared_memory_object::remove("MySharedMemory"); }
~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
//<-
#endif
//->
} remover;
//<-
(void)remover;
//->
//<-
#if 1
managed_shared_memory managed_shm(create_only,test::get_process_id_name(), 65536);
#else
//->
managed_shared_memory managed_shm(create_only,"MySharedMemory", 65536);
//<-
#endif
//->
//Allocate 16 elements of 100 bytes in a single call. Non-throwing version.
multiallocation_chain chain;