C++ Logo

STD-DISCUSSION

Advanced search

Subject: Why wrapping into a struct for aligned_storage::type?
From: Gennaro Prota (gennaro.prota_at_[hidden])
Date: 2019-11-15 04:32:03


Hi,

from n3337 (first draft after C++11):

  [Note: A typical implementation would define aligned_storage as:

  template <std::size_t Len, std::size_t Alignment>
  struct aligned_storage {
    typedef struct {
      alignas(Alignment) unsigned char __data[Len];
    } type;
  };

I wonder: why the additional struct around the array?

-- 
--
.:: Gennaro Prota ::.
.:: https://about.me/gennaro.prota ::.

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups