7#include "../mobject/declaration.hpp"
14 { std::cout << a } -> std::same_as<std::ostream&>;
20 { x.to_string() } -> std::same_as<std::string>;
23 if constexpr (std::is_arithmetic_v<T>)
24 os << c.
real << (c.
imag >= 0 ?
" + " :
" - ") <<
"j" << abs(c.
imag);
26 os << c.
real <<
" + " <<
"j(" << c.
imag <<
")";
28 os << c.
real.to_string() <<
" + j(" << c.
imag.to_string() <<
")";
31template <
typename T,
size_t _rows,
size_t _cols>
32 requires concepts::OstreamOverwrite<T> ||
requires(T x) {
33 { x.to_string() } -> std::same_as<std::string>;
42 os << (++i < _rows ?
",\n" :
"");
50 os << (++i < _rows ?
",\n" :
"");
56template <
typename T,
size_t _size>
57 requires concepts::OstreamOverwrite<T> ||
requires(T x) {
58 { x.to_string() } -> std::same_as<std::string>;
65 os << c << (++i < _size ?
", " :
"");
71 os << c.to_string() << (++i < _size ?
", " :
"");
79 requires concepts::OstreamOverwrite<T> ||
requires(T x) {
80 { x.to_string() } -> std::same_as<std::string>;
84 constexpr auto fn = [](T x) {
return x >= 0 ?
" + " :
" - "; };
85 os << q.
r() << fn(q.
i()) << abs(q.
i()) <<
"i" << fn(q.
j()) << abs(q.
j())
86 <<
"j" << fn(q.
k()) << abs(q.
k()) <<
"k";
88 os << q.
r().to_string() <<
" + " << q.
i().to_string() <<
"i + "
89 << q.
j().to_string() <<
"j + " << q.
k().to_string() <<
"k";
Complex number class template
Quaternion class template
constexpr _Tp & r()
Get scalar part of the quaternion
constexpr _Tp & i()
Get i-component of the quaternion
constexpr _Tp & k()
Get k-component of the quaternion
constexpr _Tp & j()
Get j-component of the quaternion
Compiler-specific type information handling for MSVC
std::ostream & operator<<(std::ostream &os, const complex< T > &c)