Skip to content

Commit 1157f9b

Browse files
refactor: Simplify namespace structure for numeric conversion functions
1 parent fe7e657 commit 1157f9b

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/conversion/underlying.cppm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ constexpr auto exact_rep_cast(SrcRep value)
268268

269269
} // namespace mcpplibs::primitives::conversion::details
270270

271-
export namespace mcpplibs::primitives::conversion::underlying {
271+
export namespace mcpplibs::primitives::conversion {
272272

273273
template <details::integral_like DestRep, details::integral_like SrcRep>
274274
constexpr auto numeric_risk(SrcRep value)
@@ -417,4 +417,4 @@ constexpr auto exact_cast(Src value) -> cast_result<Dest> {
417417
return underlying::traits<dest_type>::from_rep(*target_rep);
418418
}
419419

420-
} // namespace mcpplibs::primitives::conversion::underlying
420+
} // namespace mcpplibs::primitives::conversion

src/operations/operators.cppm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ constexpr auto apply_assign(Lhs &lhs, Rhs const &rhs)
542542
if constexpr (std::same_as<lhs_value_policy, policy::value::checked> &&
543543
std::integral<lhs_rep>) {
544544
if (auto const kind =
545-
conversion::underlying::numeric_risk<lhs_rep>(
545+
conversion::numeric_risk<lhs_rep>(
546546
assigned_common);
547547
kind.has_value()) {
548548
return std::unexpected(
@@ -552,7 +552,7 @@ constexpr auto apply_assign(Lhs &lhs, Rhs const &rhs)
552552
}
553553

554554
auto const assigned_rep =
555-
conversion::underlying::saturating_cast<lhs_rep>(assigned_common);
555+
conversion::saturating_cast<lhs_rep>(assigned_common);
556556
lhs.store(underlying::traits<lhs_value_type>::from_rep(assigned_rep));
557557
return out;
558558
}

src/primitive/impl.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private:
6464

6565
auto const source_rep = underlying::traits<source_value_type>::to_rep(source);
6666
auto const target_rep =
67-
conversion::underlying::saturating_cast<target_rep_type>(
67+
conversion::saturating_cast<target_rep_type>(
6868
static_cast<source_rep_type>(source_rep));
6969
return underlying::traits<std::remove_cv_t<Target>>::from_rep(target_rep);
7070
}

0 commit comments

Comments
 (0)