mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
[multi_span] Fix UB hack in static_bounds::operator=(const static_bounds&)
This commit is contained in:
commit
e898a890e0
@ -308,8 +308,6 @@ namespace details
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
|
||||||
BoundsRanges& operator=(const BoundsRanges&) = default;
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const) {}
|
BoundsRanges(const std::ptrdiff_t* const) {}
|
||||||
BoundsRanges() = default;
|
BoundsRanges() = default;
|
||||||
|
|
||||||
@ -346,9 +344,9 @@ namespace details
|
|||||||
static const size_t DynamicNum = Base::DynamicNum + 1;
|
static const size_t DynamicNum = Base::DynamicNum + 1;
|
||||||
static const size_type CurrentRange = dynamic_range;
|
static const size_type CurrentRange = dynamic_range;
|
||||||
static const size_type TotalSize = dynamic_range;
|
static const size_type TotalSize = dynamic_range;
|
||||||
const size_type m_bound;
|
private:
|
||||||
|
size_type m_bound;
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
public:
|
||||||
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const arr)
|
BoundsRanges(const std::ptrdiff_t* const arr)
|
||||||
: Base(arr + 1), m_bound(*arr * this->Base::totalSize())
|
: Base(arr + 1), m_bound(*arr * this->Base::totalSize())
|
||||||
@ -420,8 +418,6 @@ namespace details
|
|||||||
static const size_type TotalSize =
|
static const size_type TotalSize =
|
||||||
Base::TotalSize == dynamic_range ? dynamic_range : CurrentRange * Base::TotalSize;
|
Base::TotalSize == dynamic_range ? dynamic_range : CurrentRange * Base::TotalSize;
|
||||||
|
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
|
||||||
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr) {}
|
BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr) {}
|
||||||
BoundsRanges() = default;
|
BoundsRanges() = default;
|
||||||
|
|
||||||
@ -633,12 +629,6 @@ public:
|
|||||||
|
|
||||||
constexpr static_bounds() = default;
|
constexpr static_bounds() = default;
|
||||||
|
|
||||||
constexpr static_bounds& operator=(const static_bounds& otherBounds)
|
|
||||||
{
|
|
||||||
new (&m_ranges) MyRanges(otherBounds.m_ranges);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr sliced_type slice() const noexcept
|
constexpr sliced_type slice() const noexcept
|
||||||
{
|
{
|
||||||
return sliced_type{static_cast<const details::BoundsRanges<RestRanges...>&>(m_ranges)};
|
return sliced_type{static_cast<const details::BoundsRanges<RestRanges...>&>(m_ranges)};
|
||||||
|
Loading…
Reference in New Issue
Block a user