mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
refactor: std::convertible_to
replaced with std::same_as
in basic_fixed_string
This commit is contained in:
@@ -80,7 +80,7 @@ public:
|
|||||||
using difference_type = std::ptrdiff_t;
|
using difference_type = std::ptrdiff_t;
|
||||||
|
|
||||||
// construction and assignment
|
// construction and assignment
|
||||||
template<std::convertible_to<CharT>... Chars>
|
template<std::same_as<CharT>... Chars>
|
||||||
requires(sizeof...(Chars) == N) && (... && !std::is_pointer_v<Chars>)
|
requires(sizeof...(Chars) == N) && (... && !std::is_pointer_v<Chars>)
|
||||||
constexpr explicit basic_fixed_string(Chars... chars) noexcept : data_{chars..., CharT{}}
|
constexpr explicit basic_fixed_string(Chars... chars) noexcept : data_{chars..., CharT{}}
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::input_iterator It, std::sentinel_for<It> S>
|
template<std::input_iterator It, std::sentinel_for<It> S>
|
||||||
requires std::convertible_to<std::iter_value_t<It>, CharT>
|
requires std::same_as<std::iter_value_t<It>, CharT>
|
||||||
constexpr basic_fixed_string(It begin, S end)
|
constexpr basic_fixed_string(It begin, S end)
|
||||||
{
|
{
|
||||||
MP_UNITS_EXPECTS(std::distance(begin, end) == N);
|
MP_UNITS_EXPECTS(std::distance(begin, end) == N);
|
||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::ranges::input_range R>
|
template<std::ranges::input_range R>
|
||||||
requires std::convertible_to<std::ranges::range_reference_t<R>, CharT>
|
requires std::same_as<std::ranges::range_value_t<R>, CharT>
|
||||||
constexpr basic_fixed_string(std::from_range_t, R&& r)
|
constexpr basic_fixed_string(std::from_range_t, R&& r)
|
||||||
{
|
{
|
||||||
MP_UNITS_EXPECTS(std::ranges::size(r) == N);
|
MP_UNITS_EXPECTS(std::ranges::size(r) == N);
|
||||||
@@ -260,7 +260,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// deduction guides
|
// deduction guides
|
||||||
template<typename CharT, std::convertible_to<CharT>... Rest>
|
template<typename CharT, std::same_as<CharT>... Rest>
|
||||||
basic_fixed_string(CharT, Rest...) -> basic_fixed_string<CharT, 1 + sizeof...(Rest)>;
|
basic_fixed_string(CharT, Rest...) -> basic_fixed_string<CharT, 1 + sizeof...(Rest)>;
|
||||||
|
|
||||||
template<typename CharT, std::size_t N>
|
template<typename CharT, std::size_t N>
|
||||||
|
Reference in New Issue
Block a user