mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
refactor: apply comments
This commit is contained in:
committed by
Mateusz Pusz
parent
dca553ed96
commit
94eb477f02
@ -73,6 +73,11 @@ macro(_set_flags)
|
||||
|
||||
set(GCC_WARNINGS
|
||||
${CLANG_WARNINGS}
|
||||
-Wno-float-conversion
|
||||
-Wno-shorten-64-to-32
|
||||
-Wno-implicit-float-conversion
|
||||
-Wno-implicit-int-float-conversion
|
||||
-Wno-implicit-int-conversion
|
||||
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
|
||||
-Wduplicated-cond # warn if if / else chain has duplicated conditions
|
||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||
|
8
src/include/units/bits/external/hacks.h
vendored
8
src/include/units/bits/external/hacks.h
vendored
@ -31,7 +31,11 @@
|
||||
#define COMP_MSVC _MSC_VER
|
||||
#endif
|
||||
|
||||
#if COMP_CLANG && false
|
||||
#if defined(COMP_CLANG) && !defined(UNITS_LIBCXX)
|
||||
#define UNITS_LIBCXX 0
|
||||
#endif
|
||||
|
||||
#if COMP_CLANG && UNITS_LIBCXX
|
||||
|
||||
#include <concepts/compare.hpp>
|
||||
#include <concepts/concepts.hpp>
|
||||
@ -60,7 +64,7 @@ namespace std {
|
||||
template<class T>
|
||||
concept default_constructible = constructible_from<T>;
|
||||
|
||||
#elif COMP_CLANG && false
|
||||
#elif COMP_CLANG && UNITS_LIBCXX
|
||||
|
||||
// concepts
|
||||
using concepts::three_way_comparable;
|
||||
|
@ -290,7 +290,7 @@ template<typename CastSpec, typename K, typename U, typename Rep>
|
||||
requires requires { requires is_specialization_of<CastSpec, quantity_kind>;
|
||||
requires requires { quantity_cast<typename CastSpec::quantity_type>(qk.common()); }; } ||
|
||||
requires { requires Kind<CastSpec>; requires UnitOf<U, typename CastSpec::dimension>; } ||
|
||||
requires { requires requires { quantity_cast<CastSpec>(qk.common()); }; }
|
||||
requires { quantity_cast<CastSpec>(qk.common()); }
|
||||
{
|
||||
if constexpr (is_specialization_of<CastSpec, quantity_kind>)
|
||||
return CastSpec(quantity_cast<typename CastSpec::quantity_type>(qk.common()));
|
||||
@ -349,7 +349,7 @@ template<typename CastSpec, typename PK, typename U, typename Rep>
|
||||
requires requires { requires is_specialization_of<CastSpec, quantity_point_kind>;
|
||||
requires requires { quantity_kind_cast<typename CastSpec::quantity_kind_type>(qpk.relative()); }; } ||
|
||||
requires { requires PointKind<CastSpec> && UnitOf<U, typename CastSpec::dimension>; } ||
|
||||
requires { requires requires { quantity_kind_cast<CastSpec>(qpk.relative()); }; }
|
||||
requires { quantity_kind_cast<CastSpec>(qpk.relative()); }
|
||||
{
|
||||
if constexpr (is_specialization_of<CastSpec, quantity_point_kind>)
|
||||
return CastSpec(quantity_kind_cast<typename CastSpec::quantity_kind_type>(qpk.relative()));
|
||||
|
@ -44,11 +44,6 @@ using namespace unit_constants;
|
||||
|
||||
constexpr auto cgs_cm = cgs::unit_constants::cm;
|
||||
|
||||
#if UNITS_DOWNCAST_MODE == 0
|
||||
template<typename T, typename U>
|
||||
constexpr bool is_same_v = equivalent<T, U>;
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// quantity class invariants
|
||||
@ -748,7 +743,7 @@ static_assert(quantity_cast<dim_speed, kilometre_per_hour>(2000.0_q_m / 3600.0_q
|
||||
static_assert(quantity_cast<dim_length>(1 * cgs_cm) == 1 * cm);
|
||||
|
||||
static_assert(is_same_v<decltype(quantity_cast<litre>(2_q_dm3)), volume<litre, std::int64_t>>);
|
||||
static_assert(!std::same_as<decltype(quantity_cast<litre>(2_q_dm3)), volume<cubic_decimetre, std::int64_t>>);
|
||||
static_assert(!is_same_v<decltype(quantity_cast<litre>(2_q_dm3)), volume<cubic_decimetre, std::int64_t>>);
|
||||
|
||||
////////////////
|
||||
// downcasting
|
||||
|
Reference in New Issue
Block a user