Skip to content

Commit 2d95be9

Browse files
committed
Warning fixes; TRange improvements
1 parent 22e9025 commit 2d95be9

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

Diff for: source/Colors/TColor.inl

+2-2
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ namespace Langulus::Math
317317
constexpr void TColor<T>::MakeOpaque() noexcept {
318318
if constexpr (MemberCount >= 4) {
319319
if constexpr (IsReal)
320-
alpha = 1;
320+
alpha = InnerT {1};
321321
else
322-
alpha = 255;
322+
alpha = InnerT {255};
323323
}
324324
else LANGULUS(NOOP);
325325
}

Diff for: source/Ranges/TRange.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ namespace Langulus::Math
183183
///
184184
/// Assignment
185185
///
186-
constexpr auto operator = (const TRange&) noexcept -> TRange& = default;
187-
constexpr auto operator = (const CT::RangeBased auto&) noexcept -> TRange&;
186+
constexpr auto operator = (const TRange&) noexcept -> TRange&;
187+
constexpr auto operator = (const CT::RangeBased auto&) noexcept -> TRange&;
188188
constexpr auto operator = (const CT::VectorBased auto&) noexcept -> TRange&;
189189
constexpr auto operator = (const CT::ScalarBased auto&) noexcept -> TRange&;
190190

@@ -194,7 +194,7 @@ namespace Langulus::Math
194194
explicit operator Anyness::Text() const;
195195
explicit operator Flow::Code() const;
196196

197-
constexpr auto Embrace(const auto&) noexcept -> TRange&;
197+
constexpr auto Embrace(const auto&...) noexcept -> TRange&;
198198
constexpr auto ConstrainBy(const auto&) noexcept -> TRange&;
199199

200200
auto GetMin() const noexcept -> PointType const&;

Diff for: source/Ranges/TRange.inl

+11-3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ namespace Langulus::Math
9696
}
9797
}
9898

99+
/// Copy range
100+
/// @param r - the range to copy
101+
/// @return a reference to this range
102+
TEMPLATE() LANGULUS(INLINED)
103+
constexpr auto TME()::operator = (const TRange& r) noexcept -> TRange& {
104+
return *new (this) TRange {r};
105+
}
106+
99107
/// Copy range
100108
/// @param r - the range to copy
101109
/// @return a reference to this range
@@ -148,9 +156,9 @@ namespace Langulus::Math
148156
}
149157

150158
TEMPLATE() LANGULUS(INLINED)
151-
constexpr auto TME()::Embrace(const auto& other) noexcept -> TRange& {
152-
mMin = Min(mMin, other);
153-
mMax = Max(mMax, other);
159+
constexpr auto TME()::Embrace(const auto&...other) noexcept -> TRange& {
160+
((mMin = Min(mMin, other)),...);
161+
((mMax = Max(mMax, other)),...);
154162
return *this;
155163
}
156164

0 commit comments

Comments
 (0)