Commit 91bff175 authored by Paul's avatar Paul
Browse files

Formatting

parent 3d03e158
...@@ -94,7 +94,9 @@ struct raw_data : raw_data_base ...@@ -94,7 +94,9 @@ struct raw_data : raw_data_base
operator T*() operator T*()
{ {
using type = std::remove_cv_t<T>; using type = std::remove_cv_t<T>;
assert((std::is_void<T>{} or std::is_same<char, type>{} or std::is_same<unsigned char, type>{} or self->get_shape().type() == rtg::shape::get_type<T>{})); assert((std::is_void<T>{} or std::is_same<char, type>{} or
std::is_same<unsigned char, type>{} or
self->get_shape().type() == rtg::shape::get_type<T>{}));
return reinterpret_cast<type*>(self->data()); return reinterpret_cast<type*>(self->data());
} }
}; };
...@@ -103,10 +105,10 @@ struct raw_data : raw_data_base ...@@ -103,10 +105,10 @@ struct raw_data : raw_data_base
auto_cast implicit() const { return {static_cast<const Derived*>(this)}; } auto_cast implicit() const { return {static_cast<const Derived*>(this)}; }
/// Get a tensor_view to the data /// Get a tensor_view to the data
template<class T> template <class T>
tensor_view<T> get() const tensor_view<T> get() const
{ {
auto&& s = static_cast<const Derived&>(*this).get_shape(); auto&& s = static_cast<const Derived&>(*this).get_shape();
auto&& buffer = static_cast<const Derived&>(*this).data(); auto&& buffer = static_cast<const Derived&>(*this).data();
if(s.type() != rtg::shape::get_type<T>{}) if(s.type() != rtg::shape::get_type<T>{})
RTG_THROW("Incorrect data type for raw data"); RTG_THROW("Incorrect data type for raw data");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment