|
Boost Users : |
Subject: Re: [Boost-users] Problem with simple type extraction
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-08-16 16:33:01
Hi Nathan,
On Mon, Aug 16, 2010 at 3:15 PM, Nathan Crookston
<nathan.crookston_at_[hidden]> wrote:
> On Mon, Aug 16, 2010 at 12:32 PM, Christian Henning <chhenning_at_[hidden]> wrote:
>> It works for me now too. Any idea why that is?
>
> Well, apparently the reference type is declared as const somewhere in
> the GIL code (not the referenced pixel, of course). I tried to find
> exactly where the const was added in the code, but I had some trouble
> following all the many metafunction instantiations, etc -- there are
> quite a few for the declaration given.
I did not think of const since I thought there is
gray1_image_t::view_t::const_reference. Turns out there isn't a
const_reference. And maybe I got fooled by the MSVC debugger which
told me that there is no const in actual type of
gray1_image_t::view_t::reference.
>
> I did modify the metafunction slightly to give correct results
> regardless of const (and volatile) qualifiers. Perhaps it would be of
> use to you:
>
> //In addition to previous includes
> #include <boost/type_traits/remove_cv.hpp>
>
> namespace boost {
> namespace gil {
>
> template< typename T >
> struct bit_field_type_impl
> {
> typedef T type;
> };
>
> template< typename BitField, typename ChannelBitSizes,
> typename Layout, bool IsMutable >
> struct bit_field_type_impl< bit_aligned_pixel_reference< BitField
> , ChannelBitSizes
> , Layout
> , IsMutable > >
> {
> typedef BitField type;
> };
>
> template< typename T >
> struct bit_field_type
> : bit_field_type_impl<typename boost::remove_cv<T>::type > {};
>
>
> } // namespace gil
> } // namespace boost
Thanks alot for your code suggestions I'll incorporate them into my code.
Regards,
Christian
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