Boost logo

Boost Users :

Subject: [Boost-users] Problem with simple type extraction
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-08-16 10:49:29

Hi there, I cannot understand why the code below gives me a static
assertion. As far as I know I use a very common technique to to
extract a type from templated class using specialization over this

#include <boost/assert.hpp>
#include <boost/type_traits/is_same.hpp>

#include <boost/gil/gil_all.hpp>

namespace boost {
namespace gil {

template< typename T >
struct bit_field_type{ typedef T type; };

template< typename BitField,
          typename ChannelBitSizes,
          typename Layout,
          bool IsMutable
struct bit_field_type< bit_aligned_pixel_reference< BitField
                                                  , ChannelBitSizes
                                                  , Layout
                                                  , IsMutable
    typedef BitField type;

} // namespace gil
} // namespace boost

int main(int argc, char* argv[])
        typedef boost::gil::bit_aligned_image1_type< 1,
boost::gil::gray_layout_t >::type gray1_image_t;
    typedef gray1_image_t::view_t::reference ref;

        typedef boost::gil::bit_field_type< ref >::type bit_field_t;
        BOOST_STATIC_ASSERT(( boost::is_same< bit_field_t, unsigned char >::value ));

        return 0;

The type for gray1_image_t::view_t::reference is the following:

boost::gil::bit_aligned_pixel_reference< unsigned char,
boost::mpl::vector1_c< unsigned int, 1 >
                                                , boost::gil::layout< boost::mpl::vector1<
boost::gil::gray_color_t >, boost::mpl::range_c< int, 0, 1> >
                                                , 1

Can somebody tell what wrong. I have been staring at this for too
long. I'm using MS Visual Studio 9 and 10.

Thanks in advance,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at