Skip to content
Snippets Groups Projects
Commit 62b57271 authored by Sam Yates's avatar Sam Yates Committed by Ben Cumming
Browse files

Correct pointer casting operations in `uninitialized` (#101)

Correct pointer casting operations in `uninitialized`: issue #100
parent bc6bb3ba
Branches
No related tags found
No related merge requests found
...@@ -33,11 +33,11 @@ public: ...@@ -33,11 +33,11 @@ public:
using reference = X&; using reference = X&;
using const_reference= const X&; using const_reference= const X&;
pointer ptr() { return reinterpret_cast<X*>(&data); } pointer ptr() { return static_cast<X*>(static_cast<void*>(&data)); }
const_pointer cptr() const { return reinterpret_cast<const X*>(&data); } const_pointer cptr() const { return static_cast<const X*>(static_cast<void*>(&data)); }
reference ref() { return *reinterpret_cast<X*>(&data); } reference ref() { return *ptr(); }
const_reference cref() const { return *reinterpret_cast<const X*>(&data); } const_reference cref() const { return *cptr(); }
// Copy construct the value. // Copy construct the value.
template < template <
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment