| 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..8edda6a10a7fc7660bfc93afcc2c69ab192d88c4 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,16 @@ class {{export_attribute}} {{struct.name}} {
|
| return mojo::TypeConverter<U, {{struct.name}}>::Convert(*this);
|
| }
|
|
|
| - {{struct.name}}();
|
| +{% for num_params in range(struct|num_constructor_params) %}
|
| + {% if num_params == 1 %}explicit {% endif %}{{struct.name}}(
|
| +{%- set fields = struct.fields[:num_params] %}
|
| +{%- for field in fields %}
|
| +{%- 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
|
|
|