diff options
author | Neil MacIntosh <neilmac@microsoft.com> | 2016-09-29 12:49:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-29 12:49:58 -0700 |
commit | e898a890e097598009c2c079a0254f9823d2d93b (patch) | |
tree | 3e520039d3969245611efcb6fddff0818143424a | |
parent | 348a8595470b2ae7716a99ccacb8189821efb566 (diff) | |
parent | 67717ea6ae69f391807fec7ebbeb85c135e9facf (diff) | |
download | platform_external_Microsoft-GSL-e898a890e097598009c2c079a0254f9823d2d93b.tar.gz platform_external_Microsoft-GSL-e898a890e097598009c2c079a0254f9823d2d93b.tar.bz2 platform_external_Microsoft-GSL-e898a890e097598009c2c079a0254f9823d2d93b.zip |
[multi_span] Fix UB hack in static_bounds::operator=(const static_bounds&)
-rw-r--r-- | gsl/multi_span | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/gsl/multi_span b/gsl/multi_span index 40752aa..2186c7b 100644 --- a/gsl/multi_span +++ b/gsl/multi_span @@ -308,8 +308,6 @@ namespace details { } - BoundsRanges(const BoundsRanges&) = default; - BoundsRanges& operator=(const BoundsRanges&) = default; BoundsRanges(const std::ptrdiff_t* const) {} BoundsRanges() = default; @@ -346,9 +344,9 @@ namespace details static const size_t DynamicNum = Base::DynamicNum + 1; static const size_type CurrentRange = dynamic_range; static const size_type TotalSize = dynamic_range; - const size_type m_bound; - - BoundsRanges(const BoundsRanges&) = default; + private: + size_type m_bound; + public: BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr + 1), m_bound(*arr * this->Base::totalSize()) @@ -420,8 +418,6 @@ namespace details static const size_type TotalSize = Base::TotalSize == dynamic_range ? dynamic_range : CurrentRange * Base::TotalSize; - BoundsRanges(const BoundsRanges&) = default; - BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr) {} BoundsRanges() = default; @@ -633,12 +629,6 @@ public: 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 { return sliced_type{static_cast<const details::BoundsRanges<RestRanges...>&>(m_ranges)}; |