[Bf-blender-cvs] [5aa6c03fbcb] functions: use BLI_STATIC_ASSERT
Jacques Lucke
noreply at git.blender.org
Wed Jul 3 19:14:33 CEST 2019
Commit: 5aa6c03fbcb5f2d813293fb5f14b5789c108dad5
Author: Jacques Lucke
Date: Wed Jul 3 19:10:07 2019 +0200
Branches: functions
https://developer.blender.org/rB5aa6c03fbcb5f2d813293fb5f14b5789c108dad5
use BLI_STATIC_ASSERT
===================================================================
M source/blender/functions/backends/tuple/tuple.hpp
M source/blender/functions/core/data_flow_graph_builder.hpp
M source/blender/functions/core/function.hpp
M source/blender/functions/core/type.hpp
M source/blender/functions/types/numeric_lists.cpp
===================================================================
diff --git a/source/blender/functions/backends/tuple/tuple.hpp b/source/blender/functions/backends/tuple/tuple.hpp
index 7818c25f9f3..da37a14f35a 100644
--- a/source/blender/functions/backends/tuple/tuple.hpp
+++ b/source/blender/functions/backends/tuple/tuple.hpp
@@ -273,7 +273,8 @@ class Tuple {
*/
template<typename T> inline void set(uint index, const T &value)
{
- static_assert(std::is_trivial<T>::value, "this method can be used with trivial types only");
+ BLI_STATIC_ASSERT(std::is_trivial<T>::value,
+ "this method can be used with trivial types only");
this->copy_in<T>(index, value);
}
@@ -336,7 +337,8 @@ class Tuple {
*/
template<typename T> inline T get(uint index) const
{
- static_assert(std::is_trivial<T>::value, "this method can be used with trivial types only");
+ BLI_STATIC_ASSERT(std::is_trivial<T>::value,
+ "this method can be used with trivial types only");
return this->copy_out<T>(index);
}
diff --git a/source/blender/functions/core/data_flow_graph_builder.hpp b/source/blender/functions/core/data_flow_graph_builder.hpp
index cf91e042a06..7a999973fd2 100644
--- a/source/blender/functions/core/data_flow_graph_builder.hpp
+++ b/source/blender/functions/core/data_flow_graph_builder.hpp
@@ -172,7 +172,7 @@ class DataFlowGraphBuilder {
template<typename T, typename... Args> T *new_source_info(Args &&... args)
{
- static_assert(std::is_base_of<SourceInfo, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<SourceInfo, T>::value), "");
void *ptr = m_source_info_pool->allocate(sizeof(T));
T *source = new (ptr) T(std::forward<Args>(args)...);
return source;
diff --git a/source/blender/functions/core/function.hpp b/source/blender/functions/core/function.hpp
index be9b790abbc..bb96fe23b41 100644
--- a/source/blender/functions/core/function.hpp
+++ b/source/blender/functions/core/function.hpp
@@ -191,21 +191,21 @@ inline const StringRefNull Function::name() const
template<typename T> inline bool Function::has_body() const
{
std::lock_guard<std::mutex> lock(m_body_mutex);
- static_assert(std::is_base_of<FunctionBody, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<FunctionBody, T>::value), "");
return this->m_bodies.has<T>();
}
template<typename T> inline T *Function::body() const
{
std::lock_guard<std::mutex> lock(m_body_mutex);
- static_assert(std::is_base_of<FunctionBody, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<FunctionBody, T>::value), "");
return m_bodies.get<T>();
}
template<typename T, typename... Args> inline bool Function::add_body(Args &&... args)
{
std::lock_guard<std::mutex> lock(m_body_mutex);
- static_assert(std::is_base_of<FunctionBody, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<FunctionBody, T>::value), "");
if (m_bodies.has<T>()) {
return false;
diff --git a/source/blender/functions/core/type.hpp b/source/blender/functions/core/type.hpp
index 996437dc382..a37eb99b813 100644
--- a/source/blender/functions/core/type.hpp
+++ b/source/blender/functions/core/type.hpp
@@ -96,7 +96,7 @@ inline const StringRefNull Type::name() const
template<typename T> inline bool Type::has_extension() const
{
std::lock_guard<std::mutex> lock(m_extension_mutex);
- static_assert(std::is_base_of<TypeExtension, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<TypeExtension, T>::value), "");
return m_extensions.has<T>();
}
@@ -106,14 +106,14 @@ template<typename T> inline T *Type::extension() const
* Since extensions can't be removed, it might be
* to access existing extensions without a lock. */
std::lock_guard<std::mutex> lock(m_extension_mutex);
- static_assert(std::is_base_of<TypeExtension, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<TypeExtension, T>::value), "");
return m_extensions.get<T>();
}
template<typename T, typename... Args> inline bool Type::add_extension(Args &&... args)
{
std::lock_guard<std::mutex> lock(m_extension_mutex);
- static_assert(std::is_base_of<TypeExtension, T>::value, "");
+ BLI_STATIC_ASSERT((std::is_base_of<TypeExtension, T>::value), "");
if (m_extensions.has<T>()) {
return false;
diff --git a/source/blender/functions/types/numeric_lists.cpp b/source/blender/functions/types/numeric_lists.cpp
index 9af0a4db13b..3944c8ea14a 100644
--- a/source/blender/functions/types/numeric_lists.cpp
+++ b/source/blender/functions/types/numeric_lists.cpp
@@ -27,8 +27,8 @@ template<typename T> static void *default_func()
template<typename T> SharedType create_list_type(std::string name)
{
- static_assert(sizeof(SharedList<T>) == sizeof(List<T> *),
- "Currently it is assumed that only a pointer to the list is stored");
+ BLI_STATIC_ASSERT(sizeof(SharedList<T>) == sizeof(List<T> *),
+ "Currently it is assumed that only a pointer to the list is stored");
SharedType type = SharedType::New(name);
type->add_extension<CPPTypeInfoForType<SharedList<T>>>();
More information about the Bf-blender-cvs
mailing list