Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with simple type extraction
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2010-08-16 12:09:14


Hi Christian,

On Mon, Aug 16, 2010 at 8:49 AM, Christian Henning <chhenning_at_[hidden]> wrote:
> 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
> class.

I was surprised that this didn't work as well. After some
investigation, I found that adding a 'const' to the specialization
worked for me:

> template< typename BitField,
>          typename ChannelBitSizes,
>          typename Layout,
>          bool IsMutable
>        >
> struct bit_field_type</* change here*/ const bit_aligned_pixel_reference< BitField
>                                                  , ChannelBitSizes
>                                                  , Layout
>                                                  , IsMutable
>                                                  >
>                    >
> {
>    typedef BitField type;
> };
>

It wasn't working because the unspecialized bit_field_type was getting
instantiated instead.

HTH,

Nate


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net