Skip to content

Commit dedc039

Browse files
committed
fix style and cast
1 parent 7313258 commit dedc039

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/core/include/mp-units/cartesian_tensor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#pragma once
2424

2525
#include <mp-units/bits/requires_hosted.h>
26+
//
2627
#include <mp-units/bits/module_macros.h>
2728
#include <mp-units/cartesian_vector.h>
2829
#include <mp-units/framework/customization_points.h>

src/core/include/mp-units/cartesian_vector.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#pragma once
2424

2525
#include <mp-units/bits/requires_hosted.h>
26+
//
2627
#include <mp-units/bits/module_macros.h>
2728
#include <mp-units/framework/customization_points.h>
2829
#include <mp-units/framework/representation_concepts.h>
@@ -66,9 +67,10 @@ class cartesian_vector {
6667
constexpr cartesian_vector(T x, T y, T z) : _coordinates_{x, y, z} {}
6768

6869
template<typename U>
69-
requires std::constructible_from<T, U> && (!std::same_as<std::remove_cvref_t<U>, T>) &&
70-
(!std::same_as<std::remove_cvref_t<U>, cartesian_vector>)
71-
explicit constexpr cartesian_vector(U&& val) : _coordinates_{T(val), T(val), T(val)}
70+
requires std::constructible_from<T, U>
71+
constexpr explicit(!std::convertible_to<U, T>) cartesian_vector(cartesian_vector<U>&& other) :
72+
_coordinates_{static_cast<T>(std::move(other[0])), static_cast<T>(std::move(other[1])),
73+
static_cast<T>(std::move(other[2]))}
7274
{
7375
}
7476

0 commit comments

Comments
 (0)