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
Allowing partial specialization of the convert struct
This is done by adding a second, defaulted, template parameter that can
be used in conjunction of std::enable_if
An example of usage is added to the tutorial
Copy file name to clipboardExpand all lines: docs/Tutorial.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,4 +198,74 @@ Then you could use `Vec3` wherever you could use any other type:
198
198
YAML::Node node = YAML::Load("start: [1, 3, 0]");
199
199
Vec3 v = node["start"].as<Vec3>();
200
200
node["end"] = Vec3(2, -1, 0);
201
+
```
202
+
203
+
## Partial specialization
204
+
205
+
If you need to specialize the `convert` struct for a set of types instead of just one you can use partial specialization with the help of `std::enable_if` (SFINAE).
206
+
207
+
Here is a small example showing how to partially specialize the `convert` struct for all types deriving from a base class:
0 commit comments