Boost logo

Boost Users :

Subject: Re: [Boost-users] Template operator() overloading for types in a mpl::vector
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-11-02 12:56:53


AMDG

Olivier Tournaire wrote:
> 2009/11/2 Steven Watanabe <watanabesj_at_[hidden]>
>
>> You can define two overloads of operator() and use enable_if to
>> distinguish them.
>>
> I thought about this solution but did not know how to implement it. Could
> you please provide a small sample?

typedef ... grey_image_types;
typedef ... rgb_image_types;

struct any_view_min_max {
    typedef ... result_type;
    template<class View>
    typename boost::enable_if<
        boost::mpl::contains<grey_image_types, View>,
    result_type>::type operator()(const View&);
    template<class View>
    typename boost::enable_if<
        boost::mpl::contains<rgb_image_types, View>,
    result_type>::type operator()(const View&);
};

In Christ,
Steven Watanabe


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