Polymake Template Library (PTL): pm::shared_object< Object, TParams > Class Template Reference
Polymake Template Library (PTL)  4.2
pm::shared_object< Object, TParams > Class Template Reference

Inherits type< mlist_wrap< TParams... >::type, AliasHandlerTag, nop_shared_alias_handler >, and pm::shared_object_secrets.

Collaboration diagram for pm::shared_object< Object, TParams >:

Public Member Functions

 shared_object ()
 Create the attached object with its default constructor.
 
template<typename... Args>
 shared_object (Args &&... args)
 Create the attached object from given arguments.
 
 shared_object (const shared_object &s)
 Share the object attached to s.
 
shared_objectoperator= (const shared_object &s)
 Detach or delete the old instance, share the one attached to s.
 
template<typename... Args>
shared_objectreplace (Args &&... args)
 Detach or delete the old instance, create a new one from given arguments.
 
shared_objectassign_copy (const shared_object &s)
 Enforce an own copy of the given object.
 

Detailed Description

template<typename Object, typename... TParams>
class pm::shared_object< Object, TParams >

Automatic pointer to shared data

This class implements an automatic pointer to a data object that can be shared among several hosts. The data instance remains shared as far as all hosts it is attached to don't attempt to change it (read-only access). The host that wants to get read-write access to the data automatically obtains a new copy, while its former partners continue sharing the old one.

In that way, a copy of the host always shares the data instance with the original host. Assignment to a host causes it to detach the old data instance and share the new one with the host being assigned from.

The data instance is destroyed together with the last host is is attached to.

@tmplparam Object type of the attached object @index tools Automatic Pointers


The documentation for this class was generated from the following file:
  • lib/core/include/internal/shared_object.h