# Poco

# template < typename T1, typename T2 = char, typename T3 = char, typename T4 = char >

# union AlignedCharArrayUnion

Library: Foundation
Package: Dynamic
Header: Poco/Alignment.h

## Description

Helper for building an aligned character array type.

This template is used to explicitly build up a collection of aligned character types. We have to build these up using a macro and explicit specialization to cope with old versions of MSVC and GCC where only an integer literal can be used to specify an alignment constraint. Once built up here, we can then begin to indirect between these using normal C++ template parameters. This union template exposes a suitably aligned and sized character array member which can hold elements of any of up to four types.

These types may be arrays, structs, or any other types. The goal is to produce a union type containing a character array which, when used, forms storage suitable to placement new any of these types over. Support for more than four types can be added at the cost of more boiler plate.