Files
rippled/beast/smart_ptr/ContainerDeletePolicy.h
2013-10-03 19:03:10 -07:00

53 lines
1.8 KiB
C++

//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_SMARTPTR_CONTAINERDELETEPOLICY_H_INCLUDED
#define BEAST_SMARTPTR_CONTAINERDELETEPOLICY_H_INCLUDED
namespace beast {
/** The DeletePolicy provides a way to destroy objects stored in containers.
This is a specialized class. The default implementation
calls operator delete. You can customize it for your classes
by providing a suitable specialization.
A DeletePolicy must support these concepts:
DefaultConstructible
MoveConstructible (C++11)
CopyConstructible
MoveAssignable (C++11)
Destructible
*/
/** The DefaultDeletePolicy simply calls operator delete.
*/
template <typename T>
struct ContainerDeletePolicy
{
static inline void destroy (T* t)
{
delete t;
}
};
}
#endif