Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Commitcb24060
committed
Shorten Agg template usage with class template argument deduction.
Many parts of the Agg & path processing pipeline work by constructingnested templated objects that represent steps of the processingpipeline, 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 aliastypenames for the types at each intermediate step.As of C++17, this can be made simpler and shorter because class templateargument 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 thoughthey are implemented as the construction of nested objects), it may feelmore 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 parent9f7b3dd commitcb24060
3 files changed
+138
-245
lines changedLines changed: 13 additions & 16 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
Comments
(0)