Commit 6a18060
committed
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.1 parent bff64cc commit 6a18060
3 files changed
Lines changed: 138 additions & 245 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
| |||
141 | 132 | | |
142 | 133 | | |
143 | 134 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
| |||
0 commit comments