mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
refactor: _generic/dimensionless.h_ removed (units added to _unit.h_)
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/si/constants.h>
|
||||
|
@@ -1,38 +0,0 @@
|
||||
// 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 <units/dimension.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
struct dimensionless; // defined in <units/quantity_spec.h>
|
||||
struct one; // defined in <units/unit.h>
|
||||
|
||||
// clang-format off
|
||||
inline constexpr struct percent : named_unit<"%", mag<ratio(1, 100)> * one> {} percent;
|
||||
inline constexpr struct per_mille : named_unit<basic_symbol_text{"‰", "%o"}, mag<ratio(1, 1000)> * one> {} per_mille;
|
||||
// clang-format on
|
||||
|
||||
} // namespace units
|
@@ -398,8 +398,9 @@ struct derived_unit : detail::expr_fractions<derived_unit<>, Us...> {};
|
||||
*
|
||||
* Unit of a dimensionless quantity.
|
||||
*/
|
||||
inline constexpr struct one : derived_unit<> {
|
||||
} one;
|
||||
// clang-format off
|
||||
inline constexpr struct one : derived_unit<> {} one;
|
||||
// clang-format on
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -721,6 +722,12 @@ inline constexpr decltype(U * U) square;
|
||||
template<Unit auto U>
|
||||
inline constexpr decltype(U * U * U) cubic;
|
||||
|
||||
// common dimensionless units
|
||||
// clang-format off
|
||||
inline constexpr struct percent : named_unit<"%", mag<ratio{1, 100}> * one> {} percent;
|
||||
inline constexpr struct per_mille : named_unit<basic_symbol_text{"‰", "%o"}, mag<ratio(1, 1000)> * one> {} per_mille;
|
||||
// clang-format on
|
||||
|
||||
|
||||
// get_unit_symbol
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include <catch2/matchers/catch_matchers_exception.hpp>
|
||||
#include <units/customization_points.h>
|
||||
#include <units/format.h>
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_io.h>
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <units/bits/unit_text.h>
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/isq/si/si.h>
|
||||
|
||||
namespace {
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "test_tools.h"
|
||||
#include <units/dimension.h>
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
Reference in New Issue
Block a user