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
Shorten Agg template usage with class template argument deduction.
Many parts of the Agg & path processing pipeline work by constructing
nested templated objects that represent steps of the processing
pipeline, e.g. (simplified example)
```
agg::conv_transform<mpl::PathIterator> // The processing step.
tpath // The name of the result.
(path, trans); // The arguments passed to the processing step.
PathNanRemover<agg::conv_transform<mpl::PathIterator>>
nan_removed
(tpath, true, path.has_codes());
```
The current implementation makes the code shorter by introducing alias
typenames for the types at each intermediate step.
As of C++17, this can be made simpler and shorter because class template
argument deduction ("CTAD") allows not specifying the template arguments
(in angle brackets) anymore, i.e. one can write
```
agg::conv_transform tpath(path, trans);
PathNanRemover nan_removed(tpath, true, path.has_codes());
```
and the compiler will auto-fill in the required types.
Furthermore, because these steps can be seen as a pipeline (even though
they are implemented as the construction of nested objects), it may feel
more natural to write them as repeated "function" (constructor)
application, i.e.
```
auto tpath = agg::conv_transform{path, trans};
auto nan_removed = PathNanRemover{tpath, true, path.has_codes()};
```
Perform this transformation whereever applicable.
0 commit comments