C++ Logo

std-discussion

Advanced search

Why wrapping into a struct for aligned_storage::type?

From: Gennaro Prota <gennaro.prota_at_[hidden]>
Date: Fri, 15 Nov 2019 11:32:03 +0100
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 ::.

Received on 2019-11-15 04:35:00