Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the address of the unsigned char[] array from aligned_storage::address #168

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions include/boost/type_traits/aligned_storage.hpp
Expand Up @@ -42,21 +42,20 @@ struct aligned_storage_imp
{
union data_t
{
char buf[size_];

unsigned char buf[size_];
typename ::boost::type_with_alignment<alignment_>::type align_;
} data_;
void* address() const { return const_cast<aligned_storage_imp*>(this); }
void* address() const { return const_cast<unsigned char*>(data_.buf); }
};
template <std::size_t size>
struct aligned_storage_imp<size, std::size_t(-1)>
{
union data_t
{
char buf[size];
unsigned char buf[size];
::boost::detail::max_align align_;
} data_;
void* address() const { return const_cast<aligned_storage_imp*>(this); }
void* address() const { return const_cast<unsigned char*>(data_.buf); }
};

template< std::size_t alignment_ >
Expand Down