| 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 1f3ec1e2b1b8bca08314cd58275bf74b0f0a16d1..9e6e46f19e66cc6021ebf26d77eae107333c49f1 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
|
| @@ -13,7 +13,12 @@ class {{export_attribute}} {{struct.name}} {
|
| static {{constant|format_constant_declaration(nested=True)}};
|
| {%- endfor %}
|
|
|
| - static {{struct.name}}Ptr New();
|
| + template <typename... Args>
|
| + static {{struct.name}}Ptr New(Args&&... args) {
|
| + return {{struct.name}}Ptr(
|
| + base::in_place,
|
| + std::forward<Args>(args)...);
|
| + }
|
|
|
| template <typename U>
|
| static {{struct.name}}Ptr From(const U& u) {
|
| @@ -25,7 +30,15 @@ class {{export_attribute}} {{struct.name}} {
|
| return mojo::TypeConverter<U, {{struct.name}}>::Convert(*this);
|
| }
|
|
|
| - {{struct.name}}();
|
| +{% for constructor in struct|struct_constructors %}
|
| + {% if constructor.params|length == 1 %}explicit {% endif %}{{struct.name}}(
|
| +{%- for field in constructor.params %}
|
| +{%- set type = field.kind|cpp_wrapper_param_type %}
|
| +{%- set name = field.name %}
|
| + {{type}} {{name}}
|
| +{%- if not loop.last -%},{%- endif %}
|
| +{%- endfor %});
|
| +{% endfor %}
|
| ~{{struct.name}}();
|
|
|
| // Clone() is a template so it is only instantiated if it is used. Thus, the
|
|
|