vtk-m/vtkm/exec
Kenneth Moreland c41c3b7a57 Fix Variant::CastAndCall SFINAE for auto return type functors
`Variant::CastAndCall` was using the C++11 style for an `auto` return
where the return type was specified with a `->` that got the `decltype`
of the return value of the functor. This was used as part of SFINAE to
pick whether you needed the const or non-const version.

However, this was causing a problem with functions that got an error
when deducing the return type for that. This was particularly
problematic for lambda functions. For example, say you have the
following simple `CastAndCall`.

```cpp
variant.CastAndCall([](auto& x){ ++x; });
```

To determine the return type of the lambda (`void`), the function has to
be compiled. But when it is compiled with a const type, which happens
when deducing the const version of `CastAndCall`, you get a compile
error. This error is not considered a substitution error (hence SFINAE),
it is an outright error. So you get a compile error just trying to
deduce the type.

The solution was to move to the C++14 version of an auto return type. In
this case, the return type is no longer important for SFINAE and is
delayed until the function is actually compiled with the specific
template parameters. This would be a problem if the const version of
`CastAndCall` was used when the non-const version was needed. But now
both versions will pass SFINAE and thus the non-const version will be
chosen as long as the `Variant` object itself is non-const. If the
`Variant` object itself is const, then that is in fact a legitimate
error, so a compile error is OK.

One thing I find wierd is that `CastAndCall` still has a `noexcept`
expression that will likewise cause a compile error in this case.
However, it is still working. I _think_ the difference is that
`noexcept` is not used to determine template substitution/overloaded, so
is therefore ignored until the function is actually compiled.
2022-07-29 06:50:34 -06:00
..
arg Support scatter/mask for CellSetExtrude 2021-09-27 13:27:02 -06:00
cuda cuda: Fix new cuda version warnings 2022-04-07 17:50:37 -04:00
internal Fix Variant::CastAndCall SFINAE for auto return type functors 2022-07-29 06:50:34 -06:00
kokkos Add Kokkos backend 2020-08-12 13:55:24 -04:00
openmp cmake: avoid adding testing directories if testing is disabled 2021-06-01 18:40:40 -04:00
serial cmake: avoid adding testing directories if testing is disabled 2021-06-01 18:40:40 -04:00
tbb cmake: avoid adding testing directories if testing is disabled 2021-06-01 18:40:40 -04:00
testing Fix divide-by-zero in UnitTestCellInterpolate 2021-07-12 10:29:46 -06:00
AtomicArrayExecutionObject.h Add floating point atomics 2021-03-11 08:19:51 -07:00
BoundaryState.h Optimize StructuredPointGradient for non boundary points. 2020-05-22 14:58:38 -04:00
CellDerivative.h Remove some unneeded include statements from vtkm/exec 2020-06-22 09:28:51 -04:00
CellEdge.h Remove some unneeded include statements from vtkm/exec 2020-06-22 09:28:51 -04:00
CellFace.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
CellInside.h Switch from VTK-c to LCL 2019-10-07 15:38:36 -04:00
CellInterpolate.h Remove some unneeded include statements from vtkm/exec 2020-06-22 09:28:51 -04:00
CellLocator.h Completely deprecate virtual methods 2021-04-28 07:28:32 -06:00
CellLocatorBoundingIntervalHierarchy.h Support deprecated behavior of point locator pointers 2021-02-18 13:11:54 -07:00
CellLocatorMultiplexer.h Support deprecated behavior of point locator pointers 2021-02-18 13:11:54 -07:00
CellLocatorRectilinearGrid.h Support deprecated behavior of point locator pointers 2021-02-18 13:11:54 -07:00
CellLocatorTwoLevel.h Add padding to Grid struct in CellLocatorTwoLevel 2021-03-30 12:59:07 -06:00
CellLocatorUniformGrid.h Support deprecated behavior of point locator pointers 2021-02-18 13:11:54 -07:00
CellMeasure.h Fixing dashboard warnings 2022-02-02 16:15:12 +05:30
CMakeLists.txt cmake: avoid adding testing directories if testing is disabled 2021-06-01 18:40:40 -04:00
ColorTable.h Remove virtual methods from ColorTable 2020-09-14 13:26:16 -06:00
ColorTable.hxx Fix warning about return value 2020-09-14 15:04:03 -06:00
ConnectivityExplicit.h Refactor CellSetExplicit to remove NumIndices. 2019-09-30 12:27:13 -04:00
ConnectivityExtrude.h Update CellSetExtrude to not specify exec types by device 2021-02-08 16:57:16 -07:00
ConnectivityPermuted.h Make connectivity structures trivially copyable 2021-03-30 12:59:07 -06:00
ConnectivityStructured.h Make connectivity structures trivially copyable 2021-03-30 12:59:07 -06:00
ExecutionWholeArray.h Make ExecutionWholeArray objects not depend on device type 2021-02-09 19:16:51 -07:00
FieldNeighborhood.h Add CellNeighborhood 2020-07-15 14:41:32 -06:00
FunctorBase.h Always export VTK-m functor symbols 2019-08-01 12:53:54 -04:00
ParametricCoordinates.h Make sure return value of cell operations is initialized 2020-03-14 00:24:13 -06:00
PointLocator.h Completely deprecate virtual methods 2021-04-28 07:28:32 -06:00
PointLocatorSparseGrid.h Compile more sources without device compiler 2022-01-03 08:23:04 -07:00
TaskBase.h conslidate the license statement 2019-04-17 10:57:13 -06:00