Skip to content

Commit fe7e657

Browse files
refactor: Simplify namespace usage
1 parent 3bb88a9 commit fe7e657

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/conversion/underlying.cppm

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -348,73 +348,73 @@ template <underlying_type Dest, underlying_type Src>
348348
constexpr auto unchecked_cast(Src value) noexcept -> Dest {
349349
using src_type = std::remove_cv_t<Src>;
350350
using dest_type = std::remove_cv_t<Dest>;
351-
using src_rep_type = primitives::underlying::traits<src_type>::rep_type;
352-
using dest_rep_type = primitives::underlying::traits<dest_type>::rep_type;
351+
using src_rep_type = underlying::traits<src_type>::rep_type;
352+
using dest_rep_type = underlying::traits<dest_type>::rep_type;
353353

354-
auto const source_rep = primitives::underlying::traits<src_type>::to_rep(value);
354+
auto const source_rep = underlying::traits<src_type>::to_rep(value);
355355
auto const target_rep =
356356
details::unchecked_rep_cast<dest_rep_type>(static_cast<src_rep_type>(source_rep));
357-
return primitives::underlying::traits<dest_type>::from_rep(target_rep);
357+
return underlying::traits<dest_type>::from_rep(target_rep);
358358
}
359359

360360
template <underlying_type Dest, underlying_type Src>
361361
constexpr auto checked_cast(Src value) -> cast_result<Dest> {
362362
using src_type = std::remove_cv_t<Src>;
363363
using dest_type = std::remove_cv_t<Dest>;
364-
using src_rep_type = primitives::underlying::traits<src_type>::rep_type;
365-
using dest_rep_type = primitives::underlying::traits<dest_type>::rep_type;
364+
using src_rep_type = underlying::traits<src_type>::rep_type;
365+
using dest_rep_type = underlying::traits<dest_type>::rep_type;
366366

367-
auto const source_rep = primitives::underlying::traits<src_type>::to_rep(value);
367+
auto const source_rep = underlying::traits<src_type>::to_rep(value);
368368
auto const target_rep =
369369
details::checked_rep_cast<dest_rep_type>(static_cast<src_rep_type>(source_rep));
370370
if (!target_rep.has_value()) {
371371
return std::unexpected(target_rep.error());
372372
}
373373

374-
return primitives::underlying::traits<dest_type>::from_rep(*target_rep);
374+
return underlying::traits<dest_type>::from_rep(*target_rep);
375375
}
376376

377377
template <underlying_type Dest, underlying_type Src>
378378
constexpr auto saturating_cast(Src value) noexcept -> Dest {
379379
using src_type = std::remove_cv_t<Src>;
380380
using dest_type = std::remove_cv_t<Dest>;
381-
using src_rep_type = primitives::underlying::traits<src_type>::rep_type;
382-
using dest_rep_type = primitives::underlying::traits<dest_type>::rep_type;
381+
using src_rep_type = underlying::traits<src_type>::rep_type;
382+
using dest_rep_type = underlying::traits<dest_type>::rep_type;
383383

384-
auto const source_rep = primitives::underlying::traits<src_type>::to_rep(value);
384+
auto const source_rep = underlying::traits<src_type>::to_rep(value);
385385
auto const target_rep =
386386
details::saturating_rep_cast<dest_rep_type>(static_cast<src_rep_type>(source_rep));
387-
return primitives::underlying::traits<dest_type>::from_rep(target_rep);
387+
return underlying::traits<dest_type>::from_rep(target_rep);
388388
}
389389

390390
template <underlying_type Dest, underlying_type Src>
391391
constexpr auto truncating_cast(Src value) noexcept -> Dest {
392392
using src_type = std::remove_cv_t<Src>;
393393
using dest_type = std::remove_cv_t<Dest>;
394-
using src_rep_type = primitives::underlying::traits<src_type>::rep_type;
395-
using dest_rep_type = primitives::underlying::traits<dest_type>::rep_type;
394+
using src_rep_type = underlying::traits<src_type>::rep_type;
395+
using dest_rep_type = underlying::traits<dest_type>::rep_type;
396396

397-
auto const source_rep = primitives::underlying::traits<src_type>::to_rep(value);
397+
auto const source_rep = underlying::traits<src_type>::to_rep(value);
398398
auto const target_rep =
399399
details::truncating_rep_cast<dest_rep_type>(static_cast<src_rep_type>(source_rep));
400-
return primitives::underlying::traits<dest_type>::from_rep(target_rep);
400+
return underlying::traits<dest_type>::from_rep(target_rep);
401401
}
402402

403403
template <underlying_type Dest, underlying_type Src>
404404
constexpr auto exact_cast(Src value) -> cast_result<Dest> {
405405
using src_type = std::remove_cv_t<Src>;
406406
using dest_type = std::remove_cv_t<Dest>;
407-
using src_rep_type = primitives::underlying::traits<src_type>::rep_type;
408-
using dest_rep_type = primitives::underlying::traits<dest_type>::rep_type;
407+
using src_rep_type = underlying::traits<src_type>::rep_type;
408+
using dest_rep_type = underlying::traits<dest_type>::rep_type;
409409

410-
auto const source_rep = primitives::underlying::traits<src_type>::to_rep(value);
410+
auto const source_rep = underlying::traits<src_type>::to_rep(value);
411411
auto const target_rep =
412412
details::exact_rep_cast<dest_rep_type>(static_cast<src_rep_type>(source_rep));
413413
if (!target_rep.has_value()) {
414414
return std::unexpected(target_rep.error());
415415
}
416416

417-
return primitives::underlying::traits<dest_type>::from_rep(*target_rep);
417+
return underlying::traits<dest_type>::from_rep(*target_rep);
418418
}
419419

420420
} // namespace mcpplibs::primitives::conversion::underlying

0 commit comments

Comments
 (0)