Tidied up some code.
This commit is contained in:
parent
64cd6e31b0
commit
ecad915001
@ -69,27 +69,27 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace PolyVox
|
|
||||||
{
|
|
||||||
#if defined(HAS_CXX11_STATIC_ASSERT)
|
#if defined(HAS_CXX11_STATIC_ASSERT)
|
||||||
//In this case we can just use static_assert
|
//In this case we can just use static_assert
|
||||||
#define POLYVOX_STATIC_ASSERT static_assert
|
#define POLYVOX_STATIC_ASSERT static_assert
|
||||||
#else
|
#else
|
||||||
// empty default template
|
namespace PolyVox
|
||||||
template <bool b>
|
|
||||||
struct StaticAssert {};
|
|
||||||
|
|
||||||
// template specialized on true
|
|
||||||
template <>
|
|
||||||
struct StaticAssert<true>
|
|
||||||
{
|
{
|
||||||
// If the static assertion is failing then this function won't exist. It will then
|
// empty default template
|
||||||
// appear in the error message which gives a clue to the user about what is wrong.
|
template <bool b>
|
||||||
static void ERROR_The_static_assertion_has_failed() {}
|
struct StaticAssert {};
|
||||||
};
|
|
||||||
|
// template specialized on true
|
||||||
|
template <>
|
||||||
|
struct StaticAssert<true>
|
||||||
|
{
|
||||||
|
// If the static assertion is failing then this function won't exist. It will then
|
||||||
|
// appear in the error message which gives a clue to the user about what is wrong.
|
||||||
|
static void ERROR_The_static_assertion_has_failed() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#define POLYVOX_STATIC_ASSERT(condition, message) StaticAssert<(condition)>::ERROR_The_static_assertion_has_failed();
|
#define POLYVOX_STATIC_ASSERT(condition, message) StaticAssert<(condition)>::ERROR_The_static_assertion_has_failed();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#endif //__PolyVox_ErrorHandling_H__
|
#endif //__PolyVox_ErrorHandling_H__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user