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 return New( |
4 // without being asked. | |
5 StructPtrType rv(New()); | |
6 {%- for field in struct.fields %} | 4 {%- for field in struct.fields %} |
7 rv->{{field.name}} = mojo::Clone({{field.name}}); | 5 mojo::Clone({{field.name}}) |
| 6 {%- if not loop.last -%},{%- endif %} |
8 {%- endfor %} | 7 {%- endfor %} |
9 return rv; | 8 ); |
10 } | 9 } |
11 | 10 |
12 template <typename T, | 11 template <typename T, |
13 typename std::enable_if<std::is_same< | 12 typename std::enable_if<std::is_same< |
14 T, {{struct.name}}>::value>::type*> | 13 T, {{struct.name}}>::value>::type*> |
15 bool {{struct.name}}::Equals(const T& other) const { | 14 bool {{struct.name}}::Equals(const T& other) const { |
16 {%- for field in struct.fields %} | 15 {%- for field in struct.fields %} |
17 if (!mojo::internal::Equals(this->{{field.name}}, other.{{field.name}})) | 16 if (!mojo::internal::Equals(this->{{field.name}}, other.{{field.name}})) |
18 return false; | 17 return false; |
19 {%- endfor %} | 18 {%- endfor %} |
20 return true; | 19 return true; |
21 } | 20 } |
OLD | NEW |