You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d6388a
Browse filesBrowse the repository at this point in the historyBrowse files
Only translate used methods of a template class (#329)
cpp2rust materializes template specializations in order to have access
to defaulted copy or move constructors.
However, materializing all the methods of a class is wrong. Some methods
might not satisfy the constraints of the type that specializes the
class, for example:
```cpp
struct Point {
int x;
};
template <typename T> struct Box {
T val;
T get() { return val; }
// This only works for T's that have operator+.
// int is fine, Point is not.
T twice() { return val + val; }
};
```
Specializing `Box` with `int` satisfies both get and twice, however
`Point` only satisfies get.
This PR only materializes methods that are used by the specialization.
0 commit comments