|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-03-27 00:26:41
On Tuesday 26 March 2002 11:56 pm, you wrote:
> Have you left me enough hooks to hijack this for my code? In particular,
> I need to be able, given a T&, to find a type aligned with T, even on
> MSVC. That's what my code currently does. If it's possible to use the
> new type_traits stuff, I'm happy.
>
> -Dave
Sure.
template<typename Reference>
struct referent_storage {
typedef typename remove_cv<typename
remove_reference<Reference>::type>::type referent;
BOOST_STATIC_CONSTANT(std::size_t, target =
referent_alignment<Reference>::value);
typedef typename type_with_alignment<target>::type align_t;
typedef aligned_storage<align_t,referent_size<Reference>::value> type;
};
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk