mirror of
https://github.com/mpusz/mp-units.git
synced 2025-12-19 13:32:48 +01:00
Various cleanup
Some of them were clang-tidy messages, some compiler warnings.
This commit is contained in:
@@ -30,6 +30,7 @@ Checks: '
|
|||||||
-misc-include-cleaner,
|
-misc-include-cleaner,
|
||||||
-modernize-use-trailing-return-type,
|
-modernize-use-trailing-return-type,
|
||||||
-modernize-use-designated-initializers,
|
-modernize-use-designated-initializers,
|
||||||
|
-portability-avoid-pragma-once,
|
||||||
-readability-identifier-length,
|
-readability-identifier-length,
|
||||||
-readability-isolate-declaration,
|
-readability-isolate-declaration,
|
||||||
-readability-magic-numbers,
|
-readability-magic-numbers,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
|
constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
|
||||||
constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
|
constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; };
|
[[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; }
|
||||||
[[nodiscard]] constexpr size_type size() const noexcept { return size_; }
|
[[nodiscard]] constexpr size_type size() const noexcept { return size_; }
|
||||||
[[nodiscard]] static constexpr size_type max_size() noexcept { return N; }
|
[[nodiscard]] static constexpr size_type max_size() noexcept { return N; }
|
||||||
[[nodiscard]] static constexpr size_type capacity() noexcept { return N; }
|
[[nodiscard]] static constexpr size_type capacity() noexcept { return N; }
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
#ifdef MP_UNITS_IMPORT_STD
|
#ifdef MP_UNITS_IMPORT_STD
|
||||||
import std;
|
import std;
|
||||||
#else
|
#else
|
||||||
#include <array>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@@ -69,13 +68,13 @@ struct dimension_interface {
|
|||||||
template<Dimension Lhs, Dimension Rhs>
|
template<Dimension Lhs, Dimension Rhs>
|
||||||
[[nodiscard]] friend consteval Dimension auto operator*(Lhs, Rhs)
|
[[nodiscard]] friend consteval Dimension auto operator*(Lhs, Rhs)
|
||||||
{
|
{
|
||||||
return expr_multiply<derived_dimension, struct dimension_one>(Lhs{}, Rhs{});
|
return expr_multiply<derived_dimension, dimension_one>(Lhs{}, Rhs{});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Dimension Lhs, Dimension Rhs>
|
template<Dimension Lhs, Dimension Rhs>
|
||||||
[[nodiscard]] friend consteval Dimension auto operator/(Lhs, Rhs)
|
[[nodiscard]] friend consteval Dimension auto operator/(Lhs, Rhs)
|
||||||
{
|
{
|
||||||
return expr_divide<derived_dimension, struct dimension_one>(Lhs{}, Rhs{});
|
return expr_divide<derived_dimension, dimension_one>(Lhs{}, Rhs{});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Dimension Lhs, Dimension Rhs>
|
template<Dimension Lhs, Dimension Rhs>
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import std;
|
|||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <tuple>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -181,7 +180,7 @@ struct quantity_spec_interface_base {
|
|||||||
[[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs)
|
[[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs)
|
||||||
{
|
{
|
||||||
return detail::clone_kind_of<Lhs{}, Rhs{}>(
|
return detail::clone_kind_of<Lhs{}, Rhs{}>(
|
||||||
detail::expr_multiply<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(
|
detail::expr_multiply<derived_quantity_spec, dimensionless, type_list_of_quantity_spec_less>(
|
||||||
detail::remove_kind(lhs), detail::remove_kind(rhs)));
|
detail::remove_kind(lhs), detail::remove_kind(rhs)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +188,7 @@ struct quantity_spec_interface_base {
|
|||||||
[[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs)
|
[[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs)
|
||||||
{
|
{
|
||||||
return detail::clone_kind_of<Lhs{}, Rhs{}>(
|
return detail::clone_kind_of<Lhs{}, Rhs{}>(
|
||||||
detail::expr_divide<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(
|
detail::expr_divide<derived_quantity_spec, dimensionless, type_list_of_quantity_spec_less>(
|
||||||
detail::remove_kind(lhs), detail::remove_kind(rhs)));
|
detail::remove_kind(lhs), detail::remove_kind(rhs)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ constexpr bool is_basic_literal_character_set_char(char ch)
|
|||||||
{
|
{
|
||||||
// https://en.cppreference.com/w/cpp/language/charset
|
// https://en.cppreference.com/w/cpp/language/charset
|
||||||
return ch == 0x00 || (0x07 <= ch && ch <= 0x0D) || (0x20 <= ch && ch <= 0x7E);
|
return ch == 0x00 || (0x07 <= ch && ch <= 0x0D) || (0x20 <= ch && ch <= 0x7E);
|
||||||
};
|
}
|
||||||
|
|
||||||
template<typename InputIt>
|
template<typename InputIt>
|
||||||
constexpr bool is_basic_literal_character_set(InputIt begin, InputIt end) noexcept
|
constexpr bool is_basic_literal_character_set(InputIt begin, InputIt end) noexcept
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ template<typename T>
|
|||||||
return T::exponent;
|
return T::exponent;
|
||||||
else
|
else
|
||||||
return ratio{1};
|
return ratio{1};
|
||||||
};
|
}
|
||||||
|
|
||||||
template<SymbolicArg T, ratio R>
|
template<SymbolicArg T, ratio R>
|
||||||
[[nodiscard]] consteval auto power_or_T_impl()
|
[[nodiscard]] consteval auto power_or_T_impl()
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ struct unit_interface {
|
|||||||
template<Unit Lhs, Unit Rhs>
|
template<Unit Lhs, Unit Rhs>
|
||||||
[[nodiscard]] friend MP_UNITS_CONSTEVAL Unit auto operator*(Lhs lhs, Rhs rhs)
|
[[nodiscard]] friend MP_UNITS_CONSTEVAL Unit auto operator*(Lhs lhs, Rhs rhs)
|
||||||
{
|
{
|
||||||
return expr_multiply<derived_unit, struct one>(lhs, rhs);
|
return expr_multiply<derived_unit, one>(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,7 +195,7 @@ struct unit_interface {
|
|||||||
template<Unit Lhs, Unit Rhs>
|
template<Unit Lhs, Unit Rhs>
|
||||||
[[nodiscard]] friend MP_UNITS_CONSTEVAL Unit auto operator/(Lhs lhs, Rhs rhs)
|
[[nodiscard]] friend MP_UNITS_CONSTEVAL Unit auto operator/(Lhs lhs, Rhs rhs)
|
||||||
{
|
{
|
||||||
return expr_divide<derived_unit, struct one>(lhs, rhs);
|
return expr_divide<derived_unit, one>(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Unit Lhs, Unit Rhs>
|
template<Unit Lhs, Unit Rhs>
|
||||||
|
|||||||
Reference in New Issue
Block a user