diff options
author | Paolo Carlini <pcarlini@suse.de> | 2007-09-16 23:59:34 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-09-16 23:59:34 +0000 |
commit | 1f9e358abba5d658b66dab5eb6c665613224c035 (patch) | |
tree | cf810fa83f07a378b35e00b82570a36089279cd5 /libstdc++-v3 | |
parent | 57711cd1b32defc3c3d95be529039b30133c70e1 (diff) | |
download | gcc-1f9e358abba5d658b66dab5eb6c665613224c035.zip gcc-1f9e358abba5d658b66dab5eb6c665613224c035.tar.gz gcc-1f9e358abba5d658b66dab5eb6c665613224c035.tar.bz2 |
type_traits (aligned_storage): Implement in the neat and general way.
2007-09-16 Paolo Carlini <pcarlini@suse.de>
Douglas Gregor <doug.gregor@gmail.com>
* include/tr1_impl/type_traits (aligned_storage): Implement
in the neat and general way.
Co-Authored-By: Douglas Gregor <doug.gregor@gmail.com>
From-SVN: r128532
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1_impl/type_traits | 70 |
2 files changed, 10 insertions, 66 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 575055e..ec140d4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2007-09-16 Paolo Carlini <pcarlini@suse.de> + Douglas Gregor <doug.gregor@gmail.com> + + * include/tr1_impl/type_traits (aligned_storage): Implement + in the neat and general way. + 2007-09-14 Benjamin Kosnik <bkoz@redhat.com> * include/parallel/base.h (__gnu_parallel::less<Tp>): Add partial diff --git a/libstdc++-v3/include/tr1_impl/type_traits b/libstdc++-v3/include/tr1_impl/type_traits index 9035faf..4a31e8b 100644 --- a/libstdc++-v3/include/tr1_impl/type_traits +++ b/libstdc++-v3/include/tr1_impl/type_traits @@ -375,75 +375,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 { typedef typename remove_reference<_Tp>::type* type; }; /// @brief other transformations [4.8]. - - // Due to c++/19163 and c++/17743, for the time being we cannot use - // the correct, neat implementation :-( - // - // template<std::size_t _Len, std::size_t _Align> - // struct aligned_storage - // { typedef char type[_Len] __attribute__((__aligned__(_Align))); } - // - // Temporary workaround, useful for Align up to 32: - template<std::size_t, std::size_t> - struct aligned_storage { }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 1> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(1))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 2> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(2))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 4> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(4))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 8> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(8))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 16> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(16))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 32> - { + template<std::size_t _Len, std::size_t _Align> + struct aligned_storage + { union type { unsigned char __data[_Len]; - char __align __attribute__((__aligned__(32))); + struct __attribute__((__aligned__((_Align)))) { } __aligner; }; }; |