-
Notifications
You must be signed in to change notification settings - Fork 0
/
Energy.h
19 lines (15 loc) · 969 Bytes
/
Energy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef ENERGY_H
#define ENERGY_H
#include <cstdint>
using Energy = double;
constexpr Energy operator ""_Mj(unsigned long long num) { return static_cast<double>(num) * 1'000'000; }
constexpr Energy operator ""_kj(unsigned long long num) { return static_cast<double>(num) * 1'000; }
constexpr Energy operator ""_j (unsigned long long num) { return static_cast<double>(num); }
constexpr Energy operator ""_mj(unsigned long long num) { return static_cast<double>(num) / 1'000; }
constexpr Energy operator ""_uj(unsigned long long num) { return static_cast<double>(num) / 1'000'000; }
constexpr Energy operator ""_Mj(long double num) { return num * 1'000'000; }
constexpr Energy operator ""_kj(long double num) { return num * 1'000; }
constexpr Energy operator ""_j (long double num) { return num; }
constexpr Energy operator ""_mj(long double num) { return num / 1'000; }
constexpr Energy operator ""_uj(long double num) { return num / 1'000'000; }
#endif // ENERGY_H