dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
Loading...
Searching...
No Matches
math.hpp File Reference

Free-function helpers that preserve unit/measure tags. More...

#include <dimval/measure.hpp>
#include <dimval/range.hpp>
#include <dimval/traits.hpp>
#include <dimval/unit.hpp>
Include dependency graph for math.hpp:

Go to the source code of this file.

Functions

template<UnitLike U, NumericValue T>
constexpr UnitValue< U, T > dimval::midpoint (const UnitRangeValue< U, T > &r) noexcept
 Midpoint of a range's bounds.
 

Detailed Description

Free-function helpers that preserve unit/measure tags.

abs, min, max, clamp for UnitValue<U,T> and MeasureValue<M,T>, plus a midpoint helper for ranges. Without these, the natural reach is .v — which strips the tag and is the very escape hatch we want to avoid. This header is not in the umbrella; pull it in explicitly.

Function Documentation

◆ midpoint()

template<UnitLike U, NumericValue T>
constexpr UnitValue< U, T > dimval::midpoint ( const UnitRangeValue< U, T > &  r)
constexprnoexcept

Midpoint of a range's bounds.

Inclusion is irrelevant — only the bound values matter.