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
Right now a fully bound tensor operator= supports assignment from scalar types. For instance
Tensor<2,2,double> T;
T(0,0) = 0.0;
T(0,1) = 1.0;
This support happens because there is a special operator=(ScalarType) defined for the result of operator()() in the tensor. In addition, there is a completely generic operator=(T&&) version as well, which matches every right-hand-side that isn't a double.
This alternate operator=(T&&) is, in fact, overly generic. It's supposed to match any right-hand-side type that looks like a tensor... either an actual tensor or some expression that can be evaluated. This means that scalar assignments for scalar types that aren't specifically the ScalarType for the tensor won't work, even if they can implicitly be converted to the ScalarType. The will all match the generic operator=(T&&) and fail to compile because they're not tensors of the right dimension.
Tensor<2,2,double> T;
T(0,0) = 0; // <-- fails because 0 is an int
We would like to support assignment from compatible scalar types where it makes sense. This can be accomplished with some form of SFINAE on the operator= API that correctly selects the scalar assignment for compatible scalars.
The text was updated successfully, but these errors were encountered:
Right now a fully bound tensor
operator=
supports assignment from scalar types. For instanceThis support happens because there is a special
operator=(ScalarType)
defined for the result ofoperator()()
in the tensor. In addition, there is a completely genericoperator=(T&&)
version as well, which matches every right-hand-side that isn't a double.This alternate
operator=(T&&)
is, in fact, overly generic. It's supposed to match any right-hand-side type that looks like a tensor... either an actual tensor or some expression that can be evaluated. This means that scalar assignments for scalar types that aren't specifically theScalarType
for the tensor won't work, even if they can implicitly be converted to theScalarType
. The will all match the genericoperator=(T&&)
and fail to compile because they're not tensors of the right dimension.We would like to support assignment from compatible scalar types where it makes sense. This can be accomplished with some form of SFINAE on the
operator=
API that correctly selects the scalar assignment for compatible scalars.The text was updated successfully, but these errors were encountered: