[Bf-blender-cvs] [dcd4e2f7672] functions: more specific tuple access functions
Jacques Lucke
noreply at git.blender.org
Fri Mar 8 15:15:24 CET 2019
Commit: dcd4e2f76720f97b083c0451da075b2408da7128
Author: Jacques Lucke
Date: Fri Mar 8 14:06:16 2019 +0100
Branches: functions
https://developer.blender.org/rBdcd4e2f76720f97b083c0451da075b2408da7128
more specific tuple access functions
===================================================================
M source/blender/functions/backends/tuple_call/tuple.hpp
===================================================================
diff --git a/source/blender/functions/backends/tuple_call/tuple.hpp b/source/blender/functions/backends/tuple_call/tuple.hpp
index 98df36ffb43..28f17191b4b 100644
--- a/source/blender/functions/backends/tuple_call/tuple.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple.hpp
@@ -98,7 +98,7 @@ namespace FN {
}
template<typename T>
- inline void set(uint index, const T &value)
+ inline void copy_in(uint index, const T &value)
{
BLI_assert(index < m_meta->element_amount());
BLI_assert(sizeof(T) == m_meta->element_size(index));
@@ -121,7 +121,15 @@ namespace FN {
}
template<typename T>
- inline const T &get(uint index) const
+ inline void set(uint index, const T &value)
+ {
+ static_assert(std::is_trivial<T>::value,
+ "this method can be used with trivial types only");
+ this->copy_in<T>(index, value);
+ }
+
+ template<typename T>
+ inline T copy_out(uint index) const
{
BLI_assert(index < m_meta->element_amount());
BLI_assert(sizeof(T) == m_meta->element_size(index));
@@ -130,6 +138,14 @@ namespace FN {
return *(T *)this->element_ptr(index);
}
+ 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");
+ return this->copy_out<T>(index);
+ }
+
static inline void copy_element(
const Tuple &from, uint from_index,
Tuple &to, uint to_index)
More information about the Bf-blender-cvs
mailing list