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
No related branches found
No related tags found
No related merge requests found
......@@ -33,11 +33,11 @@ public:
using reference = X&;
using const_reference= const X&;
pointer ptr() { return reinterpret_cast<X*>(&data); }
const_pointer cptr() const { return reinterpret_cast<const X*>(&data); }
pointer ptr() { return static_cast<X*>(static_cast<void*>(&data)); }
const_pointer cptr() const { return static_cast<const X*>(static_cast<void*>(&data)); }
reference ref() { return *reinterpret_cast<X*>(&data); }
const_reference cref() const { return *reinterpret_cast<const X*>(&data); }
reference ref() { return *ptr(); }
const_reference cref() const { return *cptr(); }
// Copy construct the value.
template <
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment