#include #include "loki/SmallObj.h" #include "loki/Function.h" using namespace Loki; //////////////////////////////////////////////////////////////////////////////////// // // How to use FollowIntoDeath with SmallObjects? // //////////////////////////////////////////////////////////////////////////////////// typedef Loki::SmallObject < LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, LOKI_DEFAULT_CHUNK_SIZE, LOKI_MAX_SMALL_OBJECT_SIZE, LOKI_DEFAULT_OBJECT_ALIGNMENT, FollowIntoDeath::With::AsMasterLifetime > MySmallObjectBase; struct MySmallObject : public MySmallObjectBase { }; typedef SingletonHolder < MySmallObject, CreateUsingNew, FollowIntoDeath::AfterMaster::IsDestroyed > Singleton_of_with_a_MySmallObject; //////////////////////////////////////////////////////////////////////////////////// // // How to use FollowIntoDeath with classes containing a Functor/Function? // //////////////////////////////////////////////////////////////////////////////////// struct MyFunctionObject { MyFunctionObject() { functor = Functor (this, &MyFunctionObject::f); function = Function< void()>(this, &MyFunctionObject::f); } void f(){} Functor functor; Function function; }; typedef SingletonHolder < MyFunctionObject, CreateUsingNew, FollowIntoDeath::AfterMaster::Impl::ObjAllocatorSingleton>::IsDestroyed > Singleton_MyFunctionObject1; typedef SingletonHolder < MyFunctionObject, CreateUsingNew, FollowIntoDeath::AfterMaster::Impl::ObjAllocatorSingleton>::IsDestroyed > Singleton_MyFunctionObject2; //////////////////////////////////////////////////////////////////////////////////// // // Data object for all singletons // //////////////////////////////////////////////////////////////////////////////////// template