STD::RATIO(3cxx)

πŸ’… NAME 🌸

Okay bestie, this page is for std::ratio< _Num, _Den > β€” and the manual name is literally std::ratio< _Num, _Den >(3cxx), from libstdc++. It's giving "Provides compile-time rational arithmetic." Periodt. πŸ’–


✨ SYNOPSIS ✨

#include <ratio>

πŸŽ€ Public Types πŸŽ€

  • typedef ratio< num, den > type β€” the public type typedef, exactly as written. Slay. πŸ’…

🧚 Static Public Attributes 🧚

  • static constexpr intmax_t den β€” the denominator, a static constexpr intmax_t. Iconic.
  • static constexpr intmax_t num β€” the numerator, also a static constexpr intmax_t. No cap.

🌈 Detailed Description 🌈

template<intmax_t _Num, intmax_t _Den = 1>
struct std::ratio< _Num, _Den >

This class template is literally "Provides compile-time rational arithmetic." (yes, with the quote marks, it's that kind of vibe).

It represents any finite rational number with a numerator and denominator representable by compile-time constants of type intmax_t. The ratio is simplified when instantiated. Obsessed, honestly.

For example:

std::ratio<7,-21>::num == -1;
std::ratio<7,-21>::den == 3;

Those example lines are exact, bestie β€” the simplification is doing its main character thing. πŸ¦‹

🫢 Author 🫢

Generated automatically by Doxygen for libstdc++ from the source code. So not a human author, just Doxygen doing its little automated dance. πŸ’–


That's the whole page, bestie. Footer sign-off: libstdc++ for std::ratio< _Num, _Den >(3cxx) πŸ’…βœ¨ β€” and the original footer doesn't show a separate date, so no invented date from me, fr fr. πŸŽ€

πŸ“¦ where this page comes from