This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] extern/fixed-memory/archive allocator


>   template<class T, int N = 1>
>      struct aligned_storage;
>
>provides a suitably aligned contiguous storage to store N objects of
>type T. 

...tis indeed this exactly.

>The obvious implementation with non-broken g++ would be
>
>   template<class T, int N>
>     struct aligned_storage {
>        typedef unsigned char byte;
>        typedef byte store[N * sizeof(T)];
>        store storage;
>
>        byte& operator[](int i) { return storage[i]; }
>        const byte& operator[](int i) const { return storage[i]; }
>        
>        operator void*() { return storage; }
>        operator const void*() const { return storage; }
>     };

Consider naming issues resolved.... :)

I've asked Mark about the other issues. Hopefully he will add something. 
Shouldn't this be in bugzilla?

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]