Commit e5f8a6b
committed
Add template keyword to fix dependent name errors
Clang and GCC complained about this, and it's indeed needed (see e.g. https://eigen.tuxfamily.org/dox/TopicTemplateKeyword.html). MSVC accepts it without template keyword, but it's non-standard C++.
Basically, the object that we call the templated function on (head<>() or cast<>()) is itself a templated type. Because we don't know at compile time what that first templated type is, the compiler can't know what the function is that we call on it (i.e. it could be a type or operator<()). So we need the "template" keyword to tell the compiler that it's a templated function.
One way to avoid this would be to declare a template at namespace scope, like std::tuple: It has an associated get function template that is declared in the std namespace instead of being a class member, so we can do std::get<i>(t) instead of t.template get<i>(). However, that's not really a good solution here I think. There's also nothing wrong with using `template` here, it just makes the code a bit more difficult to read.1 parent b4f89ce commit e5f8a6b
File tree
2 files changed
+21
-11
lines changed- include/eos
- fitting
- render
2 files changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
| 171 | + | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
| 299 | + | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
390 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
| |||
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
415 | | - | |
416 | | - | |
417 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
418 | 424 | | |
419 | 425 | | |
420 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| |||
0 commit comments