author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
#ifndef ALIGNED_BUFFER_H |
sl@0 | 2 |
#define ALIGNED_BUFFER_H |
sl@0 | 3 |
|
sl@0 | 4 |
_STLP_BEGIN_NAMESPACE |
sl@0 | 5 |
// this is for fake initialization |
sl@0 | 6 |
template<class T> |
sl@0 | 7 |
union _Stl_aligned_buffer { |
sl@0 | 8 |
char buf[sizeof(T)]; |
sl@0 | 9 |
struct { double a; double b; } padding; |
sl@0 | 10 |
|
sl@0 | 11 |
T* operator&() { |
sl@0 | 12 |
return __REINTERPRET_CAST(T*, this); |
sl@0 | 13 |
} |
sl@0 | 14 |
|
sl@0 | 15 |
T const* operator&() const { |
sl@0 | 16 |
return __REINTERPRET_CAST(T const*, this); |
sl@0 | 17 |
} |
sl@0 | 18 |
}; |
sl@0 | 19 |
_STLP_END_NAMESPACE |
sl@0 | 20 |
|
sl@0 | 21 |
#endif |