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; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \struct CreateUsing
|
||||
///
|
||||
/// \ingroup CreationGroup
|
||||
/// Implementation of the CreationPolicy used by SingletonHolder
|
||||
/// 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>
|
||||
struct CreateUsing
|
||||
{
|
||||
template <class T>
|
||||
struct Allocator
|
||||
{
|
||||
static Alloc<T> allocator;
|
||||
template<template<class> class Alloc>
|
||||
struct CreateUsing
|
||||
{
|
||||
template <class T>
|
||||
struct Allocator
|
||||
{
|
||||
static Alloc<T> allocator;
|
||||
|
||||
static T* Create()
|
||||
{
|
||||
return new (allocator.allocate(1)) T;
|
||||
}
|
||||
static T* Create()
|
||||
{
|
||||
return new (allocator.allocate(1)) T;
|
||||
}
|
||||
|
||||
static void Destroy(T* p)
|
||||
{
|
||||
//allocator.destroy(p);
|
||||
p->~T();
|
||||
allocator.deallocate(p,1);
|
||||
}
|
||||
};
|
||||
};
|
||||
static void Destroy(T* p)
|
||||
{
|
||||
//allocator.destroy(p);
|
||||
p->~T();
|
||||
allocator.deallocate(p,1);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \struct CreateUsingMalloc
|
||||
|
@ -833,6 +833,9 @@ namespace Loki
|
|||
#endif // SINGLETON_INC_
|
||||
|
||||
// $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
|
||||
// add support of allocators with a standard interface, thanks to Miguel A. Figueroa-Villanueva
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue