// The MIT License (MIT) // // Copyright (c) 2018 Mateusz Pusz // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #pragma once #include #include namespace units { struct dimension_frequency : make_dimension_t> {}; template<> struct upcasting_traits> : upcast_to {}; template concept bool Frequency = Quantity && std::experimental::ranges::Same; template using frequency = quantity; struct millihertz : unit {}; template<> struct upcasting_traits> : upcast_to {}; struct hertz : derived_unit {}; template<> struct upcasting_traits> : upcast_to {}; struct kilohertz : unit {}; template<> struct upcasting_traits> : upcast_to {}; struct megahertz : unit {}; template<> struct upcasting_traits> : upcast_to {}; struct gigahertz : unit {}; template<> struct upcasting_traits> : upcast_to {}; struct terahertz : unit {}; template<> struct upcasting_traits> : upcast_to {}; inline namespace literals { // mHz constexpr auto operator""_mHz(unsigned long long l) { return frequency(l); } constexpr auto operator""_mHz(long double l) { return frequency(l); } // Hz constexpr auto operator""_Hz(unsigned long long l) { return frequency(l); } constexpr auto operator""_Hz(long double l) { return frequency(l); } // kHz constexpr auto operator""_kHz(unsigned long long l) { return frequency(l); } constexpr auto operator""_kHz(long double l) { return frequency(l); } // MHz constexpr auto operator""_MHz(unsigned long long l) { return frequency(l); } constexpr auto operator""_MHz(long double l) { return frequency(l); } // GHz constexpr auto operator""_GHz(unsigned long long l) { return frequency(l); } constexpr auto operator""_GHz(long double l) { return frequency(l); } // THz constexpr auto operator""_THz(unsigned long long l) { return frequency(l); } constexpr auto operator""_THz(long double l) { return frequency(l); } } // namespace literals } // namespace units