.. Copyright Shroud Project Developers. See LICENSE file for details. SPDX-License-Identifier: (BSD-3-Clause) Templates --------- Shroud will wrap templated classes and functions for explicit instantiations. The template is given as part of the ``decl`` and the instantations are listed in the ``cxx_template`` section: .. code-block:: yaml - decl: | template void TemplateArgument(ArgType arg) cxx_template: - instantiation: - instantiation: ``options`` and ``format`` may be provide to control the generated code: .. code-block:: yaml - decl: template class vector cxx_header: cxx_template: - instantiation: format: C_impl_filename: wrapvectorforint.cpp options: optblah: two - instantiation: .. from templates.yaml For a class template, the *class_name* is modified to included the instantion type. If only a single template parameter is provided, then the template argument is used. For the above example, *C_impl_filename* will default to ``wrapvector_int.cpp`` but has been explicitly changed to ``wrapvectorforint.cpp``. Functions can be created which return a templated class: .. code-block:: yaml - decl: vector getVector() The result type must be instantiated via the *cxx_template* block before it can be used.