11#include <l4/cxx/type_traits>
22 void *
operator new (size_t,
void *p)
noexcept {
return p; }
23 void operator delete (
void *) {}
25 template<
typename ...Args>
26 X(Args && ...a) : T(
cxx::forward<Args>(a)...) {}
30 void operator = (Static_container
const &) =
delete;
31 Static_container(Static_container
const &) =
delete;
32 Static_container() =
default;
34 T *get() {
return reinterpret_cast<X*
>(_s); }
35 T *operator -> () {
return get(); }
36 T &operator * () {
return *get(); }
37 operator T* () {
return get(); }
40 {
new (
reinterpret_cast<void*
>(_s)) X; }
42 template<
typename ...Args >
43 void construct(Args && ...args)
44 {
new (
reinterpret_cast<void*
>(_s)) X(cxx::forward<Args>(args)...); }
47 char _s[
sizeof(X)] __attribute__((aligned(__alignof(X))));