OLD | NEW |
1 template <typename StructPtrType> | 1 template <typename StructPtrType> |
2 {{struct.name}}Ptr {{struct.name}}::Clone() const { | 2 {{struct.name}}Ptr {{struct.name}}::Clone() const { |
3 // Use StructPtrType to prevent the compiler from trying to compile this | 3 // Use StructPtrType to prevent the compiler from trying to compile this |
4 // without being asked. | 4 // without being asked. |
5 StructPtrType rv(New()); | 5 StructPtrType rv(New()); |
6 {%- for field in struct.fields %} | 6 {%- for field in struct.fields %} |
7 rv->{{field.name}} = mojo::internal::Clone({{field.name}}); | 7 rv->{{field.name}} = mojo::Clone({{field.name}}); |
8 {%- endfor %} | 8 {%- endfor %} |
9 return rv; | 9 return rv; |
10 } | 10 } |
11 | 11 |
12 template <typename T, | 12 template <typename T, |
13 typename std::enable_if<std::is_same< | 13 typename std::enable_if<std::is_same< |
14 T, {{struct.name}}>::value>::type*> | 14 T, {{struct.name}}>::value>::type*> |
15 bool {{struct.name}}::Equals(const T& other) const { | 15 bool {{struct.name}}::Equals(const T& other) const { |
16 {%- for field in struct.fields %} | 16 {%- for field in struct.fields %} |
17 if (!mojo::internal::Equals(this->{{field.name}}, other.{{field.name}})) | 17 if (!mojo::internal::Equals(this->{{field.name}}, other.{{field.name}})) |
18 return false; | 18 return false; |
19 {%- endfor %} | 19 {%- endfor %} |
20 return true; | 20 return true; |
21 } | 21 } |
OLD | NEW |