xo-umbrella2/xo-ratio/include/xo/ratio/ratio_concept.hpp
Roland Conybeare f743ceb830 git subrepo clone git@github.com:Rconybea/xo-ratio.git xo-ratio
subrepo:
  subdir:   "xo-ratio"
  merged:   "6b51f238"
upstream:
  origin:   "git@github.com:Rconybea/xo-ratio.git"
  branch:   "main"
  commit:   "6b51f238"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:23:12 -04:00

29 lines
733 B
C++

/** @file ratio_concept.hpp
*
* Author: Roland Conybeare
**/
#pragma once
#include "numeric_concept.hpp"
namespace xo {
namespace ratio {
/* also expect:
* Ratio::num_type / Ratio::den_type rounds towards -inf
*/
template <typename Ratio>
concept ratio_concept = requires(Ratio ratio)
{
typename Ratio::component_type;
typename Ratio::component_type;
{ ratio.num() } -> std::same_as<typename Ratio::component_type>;
{ ratio.den() } -> std::same_as<typename Ratio::component_type>;
} && numeric_concept<typename Ratio::component_type>;
} /*namespace ratio*/
} /*namespace xo*/
/** end ratio_concept.hpp **/