Index: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
index c5c5e815c0aef6788b87963c949c155f144a4018..96b1d25f7af3b91ffca10be7057c877338e88e08 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
@@ -34,37 +34,18 @@ class {{struct.name}} { |
~{{struct.name}}(); |
// Clone() is a template so it is only instantiated if it is used. Thus, the |
- // bindings generator does not need to know whether typemapped native types |
- // support operator=. |
+ // bindings generator does not need to know whether Clone() or copy |
+ // constructor/assignment are available for members. |
template <typename StructPtrType = {{struct.name}}Ptr> |
- {{struct.name}}Ptr Clone() const { |
- // Use StructPtrType to prevent the compiler from trying to compile this |
- // without being asked. |
- StructPtrType rv(New()); |
-{%- for field in struct.fields %} |
-{%- if field.kind|is_object_kind and not field.kind|is_string_kind and |
- not field.kind|is_typemapped_kind %} |
- rv->{{field.name}} = {{field.name}}.Clone(); |
-{%- else %} |
- rv->{{field.name}} = {{field.name}}; |
-{%- endif %} |
-{%- endfor %} |
- return rv; |
- } |
+ {{struct.name}}Ptr Clone() const; |
// Equals() is a template so it is only instantiated if it is used. Thus, the |
- // bindings generator does not need to know whether typemapped native types |
- // support operator==. |
+ // bindings generator does not need to know whether Equals() or == operator |
+ // are available for members. |
template <typename T, |
typename std::enable_if<std::is_same< |
T, {{struct.name}}>::value>::type* = nullptr> |
- bool Equals(const T& other) const { |
- {%- for field in struct.fields %} |
- if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this->{{field.name}}, other.{{field.name}})) |
- return false; |
- {%- endfor %} |
- return true; |
- } |
+ bool Equals(const T& other) const; |
{#--- Struct members #} |
{% for field in struct.fields %} |