* Compound operators were not usable properly. * std::size_t was used in the API in places where Index should have been used.
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
//==================================================================================================
|
|
/*
|
|
ROTGEN - Runtime Overlay for Eigen
|
|
Copyright : CODE RECKONS
|
|
SPDX-License-Identifier: BSL-1.0
|
|
*/
|
|
//==================================================================================================
|
|
#pragma once
|
|
|
|
#include <type_traits>
|
|
|
|
namespace rotgen
|
|
{
|
|
template<typename A, int O, typename S, typename B, int P, typename T>
|
|
bool operator==(ref<A, O, S> lhs, ref<B, P, T> rhs)
|
|
{
|
|
return lhs.base() == rhs.base();
|
|
}
|
|
|
|
template<typename A, int O, typename S, typename B, int P, typename T>
|
|
bool operator!=(ref<A, O, S> lhs, ref<B, P, T> rhs)
|
|
{
|
|
return lhs.base() != rhs.base();
|
|
}
|
|
|
|
template<typename A, int O, typename S>
|
|
auto operator*(std::convertible_to<typename A::value_type> auto s,
|
|
ref<A, O, S> rhs)
|
|
{
|
|
return rhs * s;
|
|
}
|
|
|
|
template<typename A, int O, typename S, typename B, int P, typename T>
|
|
auto dot(ref<A, O, S> lhs, ref<B, P, T> rhs)
|
|
{
|
|
return lhs.base().dot(rhs.base());
|
|
}
|
|
|
|
template<typename A, int O, typename S>
|
|
auto mul(ref<A, O, S> lhs, std::convertible_to<typename A::value_type> auto s)
|
|
-> decltype(lhs * s)
|
|
{
|
|
return lhs * s;
|
|
}
|
|
|
|
template<typename A, int O, typename S>
|
|
auto mul(std::convertible_to<typename A::value_type> auto s, ref<A, O, S> rhs)
|
|
-> decltype(s * rhs)
|
|
{
|
|
return s * rhs;
|
|
}
|
|
|
|
template<typename A, int O, typename S>
|
|
auto div(ref<A, O, S> lhs, std::convertible_to<typename A::value_type> auto s)
|
|
-> decltype(lhs / s)
|
|
{
|
|
return lhs / s;
|
|
}
|
|
}
|