Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] Why does 'get_color' take a tag object instead of its type only?
From: Christian Henning (chhenning_at_[hidden])
Date: 2013-01-29 11:16:24


> Uh... maybe I didn't express clearly.
> It's currently defined as:
>
> template <typename ColorBase, typename Color>
> get_color(ColorBase& cb, Color=Color())
>
> I just want to know why not just take Color by the type, e.g.
>
> template <typename Color, typename ColorBase>
> get_color(ColorBase& cb)
>

Sorry, I cannot comment on the this design decision. In case it really
annoys you. You could just:

template< typename Color, typename Color_Base >
typename color_element_reference_type<Color_Base,Color>::type foo(
Color_Base& p )
{
    return get_color( p, Color() );
}

template< typename Color, typename Color_Base >
typename color_element_const_reference_type<Color_Base,Color>::type
foo( const Color_Base& p )
{
    return get_color( p, Color() );
}

int main()
{
    unsigned char ff = foo<red_t>( p );

    return 0;
}

Hope this helps.

>
> I'm trying the non-intrusive (adapted) approach to make it a Fusion
> Sequence, I'll back to here when done.
>
> Code above could be rewritten as:
> fusion::at_key<red_t>(a) == fusion::at_key<red_t>(b)
>

Was Fusion around when gil was introduced?

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