@@ -127,6 +127,8 @@ namespace stdsharp
127
127
using ref_collapse_t = typename ref_collapse<T, U...>::type;
128
128
129
129
template <typename T, typename ... U>
130
+ using const_collapse_t = std::
131
+ conditional_t <(std::is_const_v<T> || ... || std::is_const_v<U>), std::add_const_t <T>, T>;
130
132
}
131
133
132
134
namespace stdsharp ::details
@@ -484,98 +486,47 @@ namespace stdsharp
484
486
485
487
template <typename T>
486
488
inline constexpr std::string_view type_id = ::nameof::nameof_full_type<T>();
489
+ }
487
490
488
- namespace literals
491
+ namespace stdsharp ::literals
492
+ {
493
+ template <std::size_t Size>
494
+ struct ltr : std::array<char , Size>
489
495
{
490
- template <std::size_t Size>
491
- struct ltr : std::array<char , Size>
492
- {
493
- private:
494
- using array_t = const char (&)[Size]; // NOLINT(*-avoid-c-arrays)
495
-
496
- public:
497
- using base = std::array<char , Size>;
498
- using base::base;
499
-
500
- constexpr ltr (array_t arr) noexcept { std::ranges::copy (arr, base::begin ()); }
496
+ private:
497
+ using array_t = const char (&)[Size]; // NOLINT(*-avoid-c-arrays)
501
498
502
- constexpr ltr& operator =(array_t arr) noexcept
503
- {
504
- std::ranges::copy (arr, base::begin ());
505
- return *this ;
506
- }
499
+ public:
500
+ using base = std::array<char , Size>;
501
+ using base::base;
507
502
508
- [[nodiscard]] constexpr operator std::string_view () const noexcept
509
- {
510
- return {base::data (), Size - 1 };
511
- }
503
+ constexpr ltr (array_t arr) noexcept { std::ranges::copy (arr, base::begin ()); }
512
504
513
- [[nodiscard]] constexpr auto to_string_view () const noexcept
514
- {
515
- return static_cast <std::string_view>(*this );
516
- }
517
- };
518
-
519
- template <std::size_t Size>
520
- ltr (const char (&)[Size]) -> ltr<Size>; // NOLINT(*-avoid-c-arrays)
521
-
522
- template <ltr Ltr>
523
- [[nodiscard]] constexpr auto operator " " _ltr() noexcept
505
+ constexpr ltr& operator =(array_t arr) noexcept
524
506
{
525
- return Ltr;
507
+ std::ranges::copy (arr, base::begin ());
508
+ return *this ;
526
509
}
527
- }
528
- }
529
510
530
- namespace stdsharp ::details
531
- {
532
- template <typename T>
533
- struct ebo_union
534
- {
535
- union type
511
+ [[nodiscard]] constexpr operator std::string_view () const noexcept
536
512
{
537
- T v;
538
- };
539
- };
513
+ return {base::data (), Size - 1 };
514
+ }
540
515
541
- template <typename T>
542
- requires std::is_empty_v<T>
543
- struct ebo_union <T>
544
- {
545
- union type
516
+ [[nodiscard]] constexpr auto to_string_view () const noexcept
546
517
{
547
- STDSHARP_NO_UNIQUE_ADDRESS T v ;
548
- };
518
+ return static_cast <std::string_view>(* this ) ;
519
+ }
549
520
};
550
521
551
- template <
552
- typename T,
553
- typename Tuple,
554
- typename = std::make_index_sequence<std::tuple_size_v<Tuple>>>
555
- struct piecewise_traits ;
522
+ template <std::size_t Size>
523
+ ltr (const char (&)[Size]) -> ltr<Size>; // NOLINT(*-avoid-c-arrays)
556
524
557
- template <typename T, typename Tuple, std:: size_t ... I >
558
- struct piecewise_traits <T, Tuple, std::index_sequence<I...>>
525
+ template <ltr Ltr >
526
+ [[nodiscard]] constexpr auto operator " " _ltr() noexcept
559
527
{
560
- static constexpr auto constructible_from =
561
- requires { requires std::constructible_from<T, get_element_t <I, Tuple>...>; };
562
-
563
- static constexpr auto nothrow_constructible_from =
564
- requires { requires std::is_nothrow_constructible_v<T, get_element_t <I, Tuple>...>; };
565
- };
566
- }
567
-
568
- namespace stdsharp
569
- {
570
- template <typename T>
571
- using ebo_union = details::ebo_union<T>::type;
572
-
573
- template <typename T, typename Tuple>
574
- concept piecewise_constructible_from = details::piecewise_traits<T, Tuple>::constructible_from;
575
-
576
- template <typename T, typename Tuple>
577
- concept piecewise_nothrow_constructible_from =
578
- details::piecewise_traits<T, Tuple>::nothrow_constructible_from;
528
+ return Ltr;
529
+ }
579
530
}
580
531
581
532
namespace meta ::extension
0 commit comments