Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-04-10 13:10:11


"Douglas Gregor" <gregod_at_[hidden]> wrote in message
news:200204100412.g3A4CFo22712_at_mailout6-0.nyroc.rr.com...
> On Tuesday 09 April 2002 10:27 am, you wrote:
> > The latest alignment_traits is broken on borland 5.5.1 and 5.6. I have
> > tried finding a fix but have not come up with anything. Can anyone help
> > please.
> >
> > Error E2231 c:\usr\boost\boost/type_traits/alignment_traits.hpp 183:
Member
> > type_with_alignment<Align>::t1_aligned cannot be used without an object
>
> This problem is now fixed for all compilers I was able to easily test:
> Borland C++ 5.5.1, MSVC 6.0sp5, and GCC 2.95.3.
>
> Doug

Excelent!

BTW, the typedef 'this_type' which I introduced in my fix just in order to
use ctv_warp<> is not needed anymore... But you have left it in the code:

template <int Align>
class type_with_alignment
{
  typedef detail::lower_alignment<Align> t1;

  typedef type_with_alignment<Align> this_type; // <==============

  typedef typename detail::ct_if<
              (detail::is_aligned<(alignment_of<t1>::value), Align>::value)
            , t1
            , detail::max_align
>::type align_t;

  BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of<align_t>::value);

  BOOST_STATIC_ASSERT(found >= Align);
  BOOST_STATIC_ASSERT(found % Align == 0);

public:
  typedef align_t type;
};

(NOTE: I needed to write the extra typedef because bcb didn't liked
"ctv_wrap< type_with_alignment<Align> >" directly)

--
Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk