MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mass.hpp
Go to the documentation of this file.
1/*
2
3Copyright 2025 Matthew Tolman
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17*/
18
19#ifndef MTCORE_UNITS_MASS_HPP
20#define MTCORE_UNITS_MASS_HPP
21
22#include "mass.hpp"
23#include "mtcore/units/base.hpp"
24
25namespace mtcore::units {
26 namespace mass {
44
46 constexpr auto metric_ton = tonne;
47
57
58 static_assert(1. * slug == 14.59390 * kilogram);
59 static_assert(1. * pound == .45359237 * kilogram);
60 static_assert(16. * ounce == 1. * pound);
61 static_assert(16. * dram == 1. * ounce);
62 static_assert(7000. * grain == 1. * pound);
63 static_assert(1. * long_hundredweight == 112. * pound);
64 static_assert(1. * ton == 2000. * pound);
65 static_assert(1. * long_ton == 2240. * pound);
66 } // namespace mass
67
68 MTCORE_DEF_UNIT_NAME_SI(mass, gram, gram, g)
69 MTCORE_DEF_UNIT_NAME(mass, slug, sl)
70 MTCORE_DEF_UNIT_NAME(mass, pound, lb)
71 MTCORE_DEF_UNIT_NAME(mass, ounce, oz)
72 MTCORE_DEF_UNIT_NAME(mass, dram, dr)
73 MTCORE_DEF_UNIT_NAME(mass, grain, gr)
74 MTCORE_DEF_UNIT_NAME_STRS(mass, hundredweight, "US (short) hundredweight", "hundredweight", "US cwt", "US cwt", "cwt",
75 "")
76 MTCORE_DEF_UNIT_NAME_STRS(mass, long_hundredweight, "long hundredweight", "long hundredweight", "long cwt",
77 "long cwt", "long cwt", "")
78 MTCORE_DEF_UNIT_NAME_STRS(mass, ton, "short ton", "ton", "short ton", "short ton", "ton", "")
79 MTCORE_DEF_UNIT_NAME_STRS(mass, long_ton, "long ton", "long ton", "ton", "ton", "long ton", "")
80} // namespace mtcore::units
81
82#endif // MTCORE_UNITS_MASS_HPP
constexpr auto gigagram
Definition mass.hpp:40
constexpr auto megagram
Definition mass.hpp:39
constexpr auto long_hundredweight
Definition mass.hpp:54
constexpr auto hundredweight
Definition mass.hpp:53
constexpr auto nanogram
Definition mass.hpp:30
constexpr auto femtogram
Definition mass.hpp:28
constexpr auto ounce
Definition mass.hpp:50
constexpr auto attogram
Definition mass.hpp:27
constexpr auto slug
Definition mass.hpp:48
constexpr auto centigram
Definition mass.hpp:33
constexpr auto gram
Definition mass.hpp:35
constexpr auto picogram
Definition mass.hpp:29
constexpr auto petagram
Definition mass.hpp:42
constexpr auto decigram
Definition mass.hpp:34
constexpr auto long_ton
Definition mass.hpp:56
constexpr auto pound
Definition mass.hpp:49
constexpr auto tonne
Definition mass.hpp:45
constexpr auto exagram
Definition mass.hpp:43
constexpr auto ton
Definition mass.hpp:55
constexpr auto milligram
Definition mass.hpp:32
constexpr auto grain
Definition mass.hpp:52
constexpr auto hectogram
Definition mass.hpp:37
constexpr auto dram
Definition mass.hpp:51
constexpr auto metric_ton
Definition mass.hpp:46
constexpr auto teragram
Definition mass.hpp:41
constexpr auto kilogram
Definition mass.hpp:38
constexpr auto decagram
Definition mass.hpp:36
constexpr auto microgram
Definition mass.hpp:31
Base namespace for units.
Definition angle.hpp:24
long hundredweight
Definition mass.hpp:76
MTCORE_DEF_UNIT_NAME_STRS(volume, fluid::us_gal, "US gallon", "gallon", "US gal", "US gal", "gal", "")
List of units.
#define MTCORE_DEF_UNIT_NAME_SI(NS, UNIT, US_NAME, ABBREV)
#define MTCORE_DEF_UNIT_NAME(NS, UNIT, ABBREV)