| 85 | }; |
| 86 | |
| 87 | TypeInfos* TypeInfos::get() { |
| 88 | static aligned_storage<sizeof(TypeInfos), alignof(TypeInfos)>::type memory; |
| 89 | |
| 90 | struct Instance { |
| 91 | TypeInfos* ptr() { return reinterpret_cast<TypeInfos*>(memory.data); } |
| 92 | Instance() { new (ptr()) TypeInfos(); } |
| 93 | ~Instance() { ptr()->release(); } |
| 94 | }; |
| 95 | |
| 96 | static Instance instance; |
| 97 | return instance.ptr(); |
| 98 | } |
| 99 | |
| 100 | } // namespace |
| 101 |