-
Notifications
You must be signed in to change notification settings - Fork 0
/
ostream.cpp
36 lines (34 loc) · 898 Bytes
/
ostream.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <benri/si/si.h>
#include <iostream>
template <class Unit>
auto operator<<(std::ostream& os, const benri::quantity<Unit>& value) -> std::ostream&
{
os << value.value() << "?";
return os;
}
auto operator<<(std::ostream& os, const benri::quantity<benri::si::second_t>& value)
-> std::ostream&
{
os << value.value() << "s";
return os;
}
auto operator<<(std::ostream& os, const benri::quantity<benri::si::minute_t>& value)
-> std::ostream&
{
os << value.value() << "min";
return os;
}
auto operator<<(std::ostream& os, const benri::quantity<benri::si::hour_t>& value)
-> std::ostream&
{
os << value.value() << "h";
return os;
}
int main()
{
using namespace benri::si;
std::cout << "Long time no see!\n"
<< "(Last time: " << 357_hour << ':' << 20_minute << ':' << 11_second
<< ")\n"
<< std::flush;
}