Sequoia
Loading...
Searching...
No Matches
Classes | Typedefs | Variables
sequoia::maths::impl Namespace Reference

Class designed for inheritance by concerete coordinate types. More...

Classes

struct  is_units_terminated_pack
 
struct  is_units_terminated_pack< B, Rep, std::tuple< Args... >, std::index_sequence< Is... > >
 
struct  noexcept_spec
 
struct  noexcept_spec< C >
 
struct  ratio_product
 
struct  ratio_product< Relaxed, ratio< Num1, Den1 >, ratio< Num2, Den2 > >
 
struct  ratio_product< Relaxed, ratio< Num1, Den1 >, std::ratio< Num2, Den2 > >
 
struct  ratio_product< Relaxed, std::ratio< Num1, Den1 >, ratio< Num2, Den2 > >
 
struct  ratio_product< Relaxed, std::ratio< Num1, Den1 >, std::ratio< Num2, Den2 > >
 
struct  static_storage
 
struct  static_storage< std::array< T, N > >
 

Typedefs

template<allow_ratio_fp_conversion Relaxed, class T , class U >
using ratio_product_t = ratio_product< Relaxed, T, U >::type
 

Variables

template<class C >
constexpr bool noexcept_spec_v {noexcept_spec<C>::value}
 

Detailed Description

Class designed for inheritance by concerete coordinate types.

The type has protected special member functions (including the destructor) and uses deducing-this patterns as a type-rich alternative to virtual dispatch. The purpose of this approach is solely code reduction. In the maths namespace the coordintates namespace derives from coordinates_base, and it turns out to be convenient for the former to have several different specializations.

Furthermore, there are applications in physics which have enough in common with maths::coordinates, but are sufficiently distinct, for a base class to be extremely useful in terms of reducing what would otherwise be very significant code duplication.

One of the novelties in the context of physics is the notion of units and quantities of different types that can nevertheless be multipled and in some cases (like widths and heights) added.

Morally, for a space of dimension D, coordinates_base wraps D values of the appropriate arithmetic type. However, this wrapping does introduce some subtleties. Most notable, the rules for arithmetic promotion are not those of the fundamental types. For example, unary plus simply returns a copy, without attempting to promote the return type such that it wraps the appropriately promoted arithmetic type.