boostorg / qvm

Boost Quaternions, Vectors, Matrices library
Boost Software License 1.0
81 stars 45 forks source link

cmp should not use deduce_scalar #18

Closed agate-pris closed 4 years ago

agate-pris commented 4 years ago

cmp should not use deduce_scalar. cmp should use the function object of an argument directly.

Document of cmp says...

Similar to operator==, except that the individual elements of a and b are passed

but it use deduce_scalar and convert values.

The document of deduce_scalar says...

This template is used by generic binary operations that return a scalar, to deduce the return type based on the (possibly different) scalars of their arguments.

I think cmp does not need deduce_scalar because it does not return a scalar.

I used cmp with vec<double, 3> and vec<unsigned long long, 3> and it cause unexpected error below.

no type named type in boost::qvm::deduce_scalar_detail::deduce_scalar_impl<double, unsigned long long> typedef typename deduce_scalar_detail::deduce_scalar_impl<A,B>::type type;

Also cmp uses row array of scalar type of arguments a and b. It will not work if scalar types of that are not default constructible. And it uses assign to row array but it will not work if user does not include row array adaption. It is not desirable for the library itself to include it, as the user may wish not to adapt.