forked from teamnwah/openmw-tes3coop
Remove BOOST_STATIC_ASSERT to fix clang warnings
This commit is contained in:
parent
93656aa6cf
commit
78ac37b52a
1 changed files with 4 additions and 23 deletions
|
@ -4,15 +4,11 @@
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
// c++11 replacement
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
|
|
||||||
/** \brief stores one object of any class derived from Base.
|
/** \brief stores one object of any class derived from Base.
|
||||||
* Requesting a certain dereived class via get() either returns
|
* Requesting a certain derived class via get() either returns
|
||||||
* the stored object if it has the correct type or otherwise replaces
|
* the stored object if it has the correct type or otherwise replaces
|
||||||
* it with an object of the requested type.
|
* it with an object of the requested type.
|
||||||
*/
|
*/
|
||||||
|
@ -22,17 +18,6 @@ namespace MWMechanics
|
||||||
private:
|
private:
|
||||||
Base* mStorage;
|
Base* mStorage;
|
||||||
|
|
||||||
// assert that Derived is derived from Base.
|
|
||||||
template< class Derived >
|
|
||||||
void assert_derived()
|
|
||||||
{
|
|
||||||
// c++11:
|
|
||||||
// static_assert( std::is_base_of<Base,Derived> , "DerivedClassStorage may only store derived classes" );
|
|
||||||
|
|
||||||
// boost:
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_base_of<Base,Derived>::value));//,"DerivedClassStorage may only store derived classes");
|
|
||||||
}
|
|
||||||
|
|
||||||
//if needed you have to provide a clone member function
|
//if needed you have to provide a clone member function
|
||||||
DerivedClassStorage( const DerivedClassStorage& other );
|
DerivedClassStorage( const DerivedClassStorage& other );
|
||||||
DerivedClassStorage& operator=( const DerivedClassStorage& );
|
DerivedClassStorage& operator=( const DerivedClassStorage& );
|
||||||
|
@ -42,8 +27,6 @@ namespace MWMechanics
|
||||||
template< class Derived >
|
template< class Derived >
|
||||||
Derived& get()
|
Derived& get()
|
||||||
{
|
{
|
||||||
assert_derived<Derived>();
|
|
||||||
|
|
||||||
Derived* result = dynamic_cast<Derived*>(mStorage);
|
Derived* result = dynamic_cast<Derived*>(mStorage);
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
|
@ -60,7 +43,6 @@ namespace MWMechanics
|
||||||
template< class Derived >
|
template< class Derived >
|
||||||
void store( const Derived& payload )
|
void store( const Derived& payload )
|
||||||
{
|
{
|
||||||
assert_derived<Derived>();
|
|
||||||
if(mStorage)
|
if(mStorage)
|
||||||
delete mStorage;
|
delete mStorage;
|
||||||
mStorage = new Derived(payload);
|
mStorage = new Derived(payload);
|
||||||
|
@ -70,7 +52,6 @@ namespace MWMechanics
|
||||||
template< class Derived >
|
template< class Derived >
|
||||||
void moveIn( Derived* p )
|
void moveIn( Derived* p )
|
||||||
{
|
{
|
||||||
assert_derived<Derived>();
|
|
||||||
if(mStorage)
|
if(mStorage)
|
||||||
delete mStorage;
|
delete mStorage;
|
||||||
mStorage = p;
|
mStorage = p;
|
||||||
|
@ -87,12 +68,12 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DerivedClassStorage():mStorage(NULL){};
|
DerivedClassStorage():mStorage(NULL){}
|
||||||
~DerivedClassStorage()
|
~DerivedClassStorage()
|
||||||
{
|
{
|
||||||
if(mStorage)
|
if(mStorage)
|
||||||
delete mStorage;
|
delete mStorage;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,7 +89,7 @@ namespace MWMechanics
|
||||||
* */
|
* */
|
||||||
struct AiTemporaryBase
|
struct AiTemporaryBase
|
||||||
{
|
{
|
||||||
virtual ~AiTemporaryBase(){};
|
virtual ~AiTemporaryBase(){}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Container for AI package status.
|
/// \brief Container for AI package status.
|
||||||
|
|
Loading…
Reference in a new issue