Paste: aligned_storage

Author: erikc
Mode: c++
Date: Tue, 13 Apr 2010 21:41:56
Plain Text |
/*!
 * \brief A std::aligned_storage-compatible type that supports extended
 * alignments greater than std::alignment_of<long double>::value.
 */
template <size_t _Len, size_t _Align>
struct aligned_storage;

#define IMPLEMENT_ALIGNED_STORAGE(_Align)                   \
    template <size_t _Len>                                  \
    struct aligned_storage<_Len, _Align>                    \
    {                                                       \
        typedef __declspec(align(_Align)) char type[_Len];  \
    };
IMPLEMENT_ALIGNED_STORAGE(1)
IMPLEMENT_ALIGNED_STORAGE(2)
IMPLEMENT_ALIGNED_STORAGE(4)
IMPLEMENT_ALIGNED_STORAGE(8)
IMPLEMENT_ALIGNED_STORAGE(16)
IMPLEMENT_ALIGNED_STORAGE(32)
#undef IMPLEMENT_ALIGNED_STORAGE

New Annotation

Summary:
Author:
Mode:
Body: