Commit 51724da5 authored by Paul's avatar Paul
Browse files

Formatting

parent 2211ade7
...@@ -35,7 +35,7 @@ struct argument : raw_data<argument> ...@@ -35,7 +35,7 @@ struct argument : raw_data<argument>
const shape& get_shape() const { return this->m_shape; } const shape& get_shape() const { return this->m_shape; }
template<class T> template <class T>
T* cast() const T* cast() const
{ {
return reinterpret_cast<T*>(this->data()); return reinterpret_cast<T*>(this->data());
......
...@@ -97,13 +97,13 @@ struct raw_data ...@@ -97,13 +97,13 @@ struct raw_data
struct auto_cast struct auto_cast
{ {
const Derived * self; const Derived* self;
template<class T> template <class T>
operator T() operator T()
{ {
return self->template at<T>(); return self->template at<T>();
} }
template<class T> template <class T>
operator T*() operator T*()
{ {
// TODO: Check type // TODO: Check type
...@@ -111,10 +111,7 @@ struct raw_data ...@@ -111,10 +111,7 @@ struct raw_data
} }
}; };
auto_cast get() const auto_cast get() const { return {static_cast<const Derived*>(this)}; }
{
return {static_cast<const Derived*>(this)};
}
}; };
namespace detail { namespace detail {
......
...@@ -37,7 +37,8 @@ struct shape ...@@ -37,7 +37,8 @@ struct shape
template <class T, class = void> template <class T, class = void>
struct get_type : std::integral_constant<type_t, any_type> struct get_type : std::integral_constant<type_t, any_type>
{}; {
};
#define RTG_SHAPE_GET_TYPE(x, t) \ #define RTG_SHAPE_GET_TYPE(x, t) \
template <class T> \ template <class T> \
struct get_type<t, T> : std::integral_constant<type_t, x> \ struct get_type<t, T> : std::integral_constant<type_t, x> \
...@@ -114,7 +115,7 @@ struct shape ...@@ -114,7 +115,7 @@ struct shape
{ {
switch(this->m_type) switch(this->m_type)
{ {
case any_type: RTG_THROW("Cannot visit the any_type"); case any_type: RTG_THROW("Cannot visit the any_type");
#define RTG_SHAPE_VISITOR_CASE(x, t) \ #define RTG_SHAPE_VISITOR_CASE(x, t) \
case x: v(as<t>()); return; case x: v(as<t>()); return;
RTG_SHAPE_VISIT_TYPES(RTG_SHAPE_VISITOR_CASE) RTG_SHAPE_VISIT_TYPES(RTG_SHAPE_VISITOR_CASE)
......
...@@ -91,7 +91,7 @@ std::string shape::type_string() const ...@@ -91,7 +91,7 @@ std::string shape::type_string() const
{ {
switch(this->m_type) switch(this->m_type)
{ {
case any_type: return "any"; case any_type: return "any";
#define RTG_SHAPE_TYPE_STRING_CASE(x, t) \ #define RTG_SHAPE_TYPE_STRING_CASE(x, t) \
case x: return #x; case x: return #x;
RTG_SHAPE_VISIT_TYPES(RTG_SHAPE_TYPE_STRING_CASE) RTG_SHAPE_VISIT_TYPES(RTG_SHAPE_TYPE_STRING_CASE)
......
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