Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-30 03:30:59


1. Someone just pointed out to me that the compressed_pair docs mention the
"empty member optimization". Shouldn't that be "empty base optimization",
instead?

============

2. I was recently trying to use compressed_pair with a type that was not
copy-constructible under gcc-3.0, but a type_traits problem prevents it:

#include <boost/compressed_pair.hpp>

struct X
{
    X(int);
};

struct Y : boost::compressed_pair<X,X> { Y(); };

int main()
{
    Y y;
};

---------

boost/type_traits/object_traits.hpp: In instantiation of
`boost::detail::empty_helper_t1<X>':
boost/type_traits/object_traits.hpp:240: instantiated from
`boost::detail::empty_helper<X, true, false>'
boost/type_traits/object_traits.hpp:258: instantiated from
`boost::is_empty<X>'
foo.cpp:8: instantiated from `boost::compressed_pair<X, X>'
foo.cpp:8: instantiated from here
boost/type_traits/object_traits.hpp:225: base `X' with only
   non-default constructor in class without a constructor

---------

I'm guessing that Howard's fix below was not for a compiler bug, but a
library bug after all? In any case could it hurt to take off the #ifdef
guards?

template <typename T>
struct empty_helper_t1 : public T
{
#ifdef __MWERKS__
   empty_helper_t1(); // hh compiler bug workaround
#endif
   int i[256];
};

-Dave


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