mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 08:39:45 +00:00
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 <stdexcept>
|
||||
|
||||
// c++11 replacement
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
||||
/** \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
|
||||
* it with an object of the requested type.
|
||||
*/
|
||||
|
@ -22,17 +18,6 @@ namespace MWMechanics
|
|||
private:
|
||||
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
|
||||
DerivedClassStorage( const DerivedClassStorage& other );
|
||||
DerivedClassStorage& operator=( const DerivedClassStorage& );
|
||||
|
@ -42,8 +27,6 @@ namespace MWMechanics
|
|||
template< class Derived >
|
||||
Derived& get()
|
||||
{
|
||||
assert_derived<Derived>();
|
||||
|
||||
Derived* result = dynamic_cast<Derived*>(mStorage);
|
||||
|
||||
if(!result)
|
||||
|
@ -60,7 +43,6 @@ namespace MWMechanics
|
|||
template< class Derived >
|
||||
void store( const Derived& payload )
|
||||
{
|
||||
assert_derived<Derived>();
|
||||
if(mStorage)
|
||||
delete mStorage;
|
||||
mStorage = new Derived(payload);
|
||||
|
@ -70,7 +52,6 @@ namespace MWMechanics
|
|||
template< class Derived >
|
||||
void moveIn( Derived* p )
|
||||
{
|
||||
assert_derived<Derived>();
|
||||
if(mStorage)
|
||||
delete mStorage;
|
||||
mStorage = p;
|
||||
|
@ -87,12 +68,12 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
|
||||
DerivedClassStorage():mStorage(NULL){};
|
||||
DerivedClassStorage():mStorage(NULL){}
|
||||
~DerivedClassStorage()
|
||||
{
|
||||
if(mStorage)
|
||||
delete mStorage;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -108,7 +89,7 @@ namespace MWMechanics
|
|||
* */
|
||||
struct AiTemporaryBase
|
||||
{
|
||||
virtual ~AiTemporaryBase(){};
|
||||
virtual ~AiTemporaryBase(){}
|
||||
};
|
||||
|
||||
/// \brief Container for AI package status.
|
||||
|
|
Loading…
Reference in a new issue