|
// Copyright � 2007, solosTec
// All rights reserved.
//---------------------------------------------------------------------
// License for redistribution is the GNU General Public License v2.
// See the included readme.txt for details.
//---------------------------------------------------------------------
// developed by solosTec
// http://www.solostec.de
//---------------------------------------------------------------------
//
// $Author: $
// $Revision: $
/* $Log: $
*/
//---------------------------------------------------------------------
/**
* Implements an initialization policy.
*/
#pragma once
namespace turban {
namespace general {
// +-----------------------------------------------------------------+
// | initialize [declaration]
// +-----------------------------------------------------------------+
/**
* Initialization policy.
*/
template < typename T >
struct initialize
{
template< class TOther_ >
struct rebind
{ // convert an initializer< T > to an initializer < TOther_ >
typedef initialize< TOther_ > other;
};
void operator()( T& value ) const
{
new( &value ) T();
}
bool operator()( T& value, const T& initialValue ) const
{
new( &value ) T( initialValue );
return value == initialValue;
}
};
} // namespace general
} // namespace turban
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.