another fight against tabs
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@488 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
3af51450a6
commit
072c1e2cdf
1 changed files with 24 additions and 21 deletions
|
@ -223,35 +223,35 @@ namespace Loki
|
||||||
{ delete p; }
|
{ delete p; }
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// \struct CreateUsing
|
/// \struct CreateUsing
|
||||||
///
|
///
|
||||||
/// \ingroup CreationGroup
|
/// \ingroup CreationGroup
|
||||||
/// Implementation of the CreationPolicy used by SingletonHolder
|
/// Implementation of the CreationPolicy used by SingletonHolder
|
||||||
/// Creates objects using a custom allocater.
|
/// Creates objects using a custom allocater.
|
||||||
/// Usage: e.g. CreateUsing<std::allocator>::Allocator
|
/// Usage: e.g. CreateUsing<std::allocator>::Allocator
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template<template<class> class Alloc>
|
template<template<class> class Alloc>
|
||||||
struct CreateUsing
|
struct CreateUsing
|
||||||
{
|
{
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Allocator
|
struct Allocator
|
||||||
{
|
{
|
||||||
static Alloc<T> allocator;
|
static Alloc<T> allocator;
|
||||||
|
|
||||||
static T* Create()
|
static T* Create()
|
||||||
{
|
{
|
||||||
return new (allocator.allocate(1)) T;
|
return new (allocator.allocate(1)) T;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Destroy(T* p)
|
static void Destroy(T* p)
|
||||||
{
|
{
|
||||||
//allocator.destroy(p);
|
//allocator.destroy(p);
|
||||||
p->~T();
|
p->~T();
|
||||||
allocator.deallocate(p,1);
|
allocator.deallocate(p,1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// \struct CreateUsingMalloc
|
/// \struct CreateUsingMalloc
|
||||||
|
@ -833,6 +833,9 @@ namespace Loki
|
||||||
#endif // SINGLETON_INC_
|
#endif // SINGLETON_INC_
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.21 2006/01/16 20:10:51 syntheticpp
|
||||||
|
// another fight against tabs
|
||||||
|
//
|
||||||
// Revision 1.20 2006/01/16 19:56:30 syntheticpp
|
// Revision 1.20 2006/01/16 19:56:30 syntheticpp
|
||||||
// add support of allocators with a standard interface, thanks to Miguel A. Figueroa-Villanueva
|
// add support of allocators with a standard interface, thanks to Miguel A. Figueroa-Villanueva
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue