Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
ScalarBinaryOpTraits.hpp File Reference

Result type and legality of a binary operation between two scalar types. More...

Classes

struct  mundy::scalar_binary_op::sum
struct  mundy::scalar_binary_op::difference
struct  mundy::scalar_binary_op::product
struct  mundy::scalar_binary_op::quotient
struct  mundy::scalar_binary_op::unary_minus
struct  mundy::scalar_binary_op::min
struct  mundy::scalar_binary_op::max
struct  mundy::ScalarBinaryOpTraits< A, B, Op >
 Determines whether a binary operation between scalar types A and B is allowed, and its result. More...
struct  mundy::ScalarBinaryOpTraits< T, T, Op >
 Same non-arithmetic type on both sides yields that type (e.g. autodiff dual op dual). More...
struct  mundy::ScalarBinaryOpTraits< A, B, Op >
 Two arithmetic primitives (same or mixed) yield their promoted common type. More...

Namespaces

namespace  mundy
namespace  mundy::scalar_binary_op
 Operation tags selecting which binary operation a ScalarBinaryOpTraits describes.

Concepts

concept  mundy::ScalarBinaryOpSupported
 Whether operation Op between scalar types A and B is supported (the trait exposes a ReturnType). Use to constrain mixed-type operators.

Typedefs

Result-type aliases
template<typename A, typename B, typename Op = scalar_binary_op::product>
using mundy::scalar_binary_op_result_t = typename ScalarBinaryOpTraits<A, B, Op>::ReturnType
 The result scalar type of operation Op between A and B (compile error if unsupported).
template<typename A, typename B>
using mundy::scalar_sum_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::sum>
template<typename A, typename B>
using mundy::scalar_difference_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::difference>
template<typename A, typename B>
using mundy::scalar_product_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::product>
template<typename A, typename B>
using mundy::scalar_quotient_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::quotient>
template<typename A, typename B>
using mundy::scalar_unary_minus_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::unary_minus>
template<typename A, typename B>
using mundy::scalar_min_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::min>
template<typename A, typename B>
using mundy::scalar_max_result_t = scalar_binary_op_result_t<A, B, scalar_binary_op::max>

Detailed Description

An operation is permitted iff the trait exposes a ReturnType; an unsupported mix has none and is a compile error. Arithmetic primitives may mix (e.g. float and double); any other mix — including a custom scalar with its passive type — is opted in by specialization.