Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-06-05 23:16:40


My apologies for the very late reply. I was away for a while and am still
sorting through my inbox...

> Platform:
> Mac OS 10.2
> gcc 3.3 compiled from sources
> boost cvs from last Friday
>
> When porting the Boost.Python bindings for some custom libraries I ran
> into a problem with static asserts in type_with_alignment.hpp:
[snip patch]
> This patch allows me to compile and link, and our regression test
> runs fine.
>
> Reducing my code to a minimal test is most likely a time-consuming
> project that I'd like to avoid if possible (compilation is quite slow
> to make things worse). Do the authors of the code above have any ideas
> what could be going wrong? Are there things that I could try first
> before chopping my code into pieces?

If you could figure out what alignment value you're trying to get a type for
it would help greatly. One way you could do it would be to replace the
static assertion lines with something that will halt the compile and give
back the Align value in an error message, e.g.,

// somewhere
template<bool DontPrintIt, std::size_t Align> struct maybe_print_align {
typedef void type; }
template<std::size_t Align> struct maybe_print_align<false, Align> {};

// instead of the static asserts:
typedef typename maybe_print_align<(found >= Align), Align>::type foobar;

Note that when those static asserts fail, it means that you aren't getting
back a type with the right alignment.

    Doug


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