shroud
shroud copied to clipboard
Templated input arguments
Hello,
I am new to shroud and was testing it out. Based on your documentation, it looks like you can return a templated class. However, for my application I need to be able to take in templated classes (often of the same type as the class, but also other datatypes). Is there anyway to do this with shroud? If not, is it possible to modify shourd for this?
Here is a basic example of what I am trying to do
// Vec.hpp
#pragma once
template <typename T>
class Vec {
public:
Vec();
void copy_from(const Vec<T>& other_vec);
Vec<T> cross(const Vec<T>& other_vec);
};
# vec.yaml - Minimal example demonstrating templated argument issue
library: VecLib
cxx_header: Vec.hpp
declarations:
- decl: |
template <typename T>
class Vec
cxx_template:
- instantiation: <int>
- instantiation: <double>
declarations:
- decl: Vec()
- decl: void copy_from(const Vec<T>& other_vec);
- decl: Vec<T> cross(const Vec<T>& other_vec);
When I run these example files I get
> shroud vec.yaml
----------------------------------------
Phase: verify attributes
----------------------------------------
Node: copy_from
line 14
void copy_from(const Vec<T> &other_vec)
Type 'Vec' may not supply template argument: const Vec<T> &other_vec
--------------------
Node: cross
line 15
Vec<T> cross(const Vec<T> &other_vec)
Type 'Vec' may not supply template argument: const Vec<T> &other_vec
Wrote veclib_types.yaml
----------------------------------------
Phase: FillMeta class function
----------------------------------------
Node: copy_from
line 14
Unknown statement: c_in_shadow<template>&
--------------------
Node: cross
line 15
Unknown statement: c_function_shadow<template>_capptr
--------------------
Node: cross
line 15
Unknown statement: c_in_shadow<template>&
--------------------
Node: copy_from
line 14
Unknown statement: c_in_shadow<template>&
--------------------
Node: cross
line 15
Unknown statement: c_function_shadow<template>_capptr
--------------------
Node: cross
line 15
Unknown statement: c_in_shadow<template>&
--------------------
Node: copy_from
line 14
Unknown statement: f_in_shadow<template>&
--------------------
Node: cross
line 15
Unknown statement: f_function_shadow<template>_capsule_caller
--------------------
Node: cross
line 15
Unknown statement: f_in_shadow<template>&
--------------------
Node: copy_from
line 14
Unknown statement: f_in_shadow<template>&
--------------------
Node: cross
line 15
Unknown statement: f_function_shadow<template>_capsule_caller
--------------------
Node: cross
line 15
Unknown statement: f_in_shadow<template>&
Wrote wrapVec_int.h
Wrote wrapVec_int.cpp
Wrote wrapVec_double.h
Wrote wrapVec_double.cpp
Wrote wrapfveclib.f
Wrote utilVecLib.cpp
Wrote typesVecLib.h
I am using the latest version
> shroud --version
0.14.0
Thank you!