Thank you Steven for your reply. It works great.
Here is what I finally did:
// struct histogram_functor
typename boost::enable_if< boost::mpl::contains<
boost::mpl::transformboost::mpl::_1
::type,
ViewType>,
result_type>::type operator()(const ViewType&
v) const
{
// ...
}
template<class ViewType>
typename boost::enable_if< boost::mpl::or_< boost::mpl::contains<
boost::mpl::transform< rgb_image_types,
add_view_type >::type,
ViewType>,
boost::mpl::contains<
boost::mpl::transform< rgba_image_types,
add_view_type >::type,
ViewType>
>,
result_type>::type operator()(const ViewType&
v) const
{
// ...
}
// ...
template <typename ImageType>
struct add_view_type
{
typedef typename ImageType::view_t type;
};
However, I have one other need: type reduction. For instance, all rgb image
types have the same overload operator(). I do not know if the solution I
came up instantiate the operator for all types, but if it is the case, it is
a valid but not a good solution. What I need is to have the same operator()
for all rgb types. I have read in a paper from L .Bourdev (
www.lubomir.org/academic/Minimizing*CodeBloat*.pdf) that I could use type
reduction, but I need some help. Can you help ?
Here is the definition of rgb_image_types:
#define RGB_IMAGE_TYPES
(boost::gil::rgb8_image_t)(boost::gil::rgb16_image_t)(boost::gil::rgb32_image_t)
typedef boost::mpl::vector< BOOST_PP_SEQ_ENUM( RGB_IMAGE_TYPES ) >
rgb_image_types;
Best regards,
Olivier