| Home | Libraries | People | FAQ | More

## Implementation Notes

`optional<T>` is currently implemented using a custom aligned storage facility built from `alignment_of` and `type_with_alignment` (both from Type Traits). It uses a separate boolean flag to indicate the initialization state. Placement new with `T`'s copy/move constructor and `T`'s destructor are explicitly used to initialize, copy, move and destroy optional values. As a result, `T`'s default constructor is effectively by-passed, but the exception guarantees are basic. It is planned to replace the current implementation with another with stronger exception safety, such as a future `boost::variant`.