2005-12-07 11:51:00 +01:00
|
|
|
#ifndef ARABICA_UTILS_GET_PARAM_HPP
|
|
|
|
#define ARABICA_UTILS_GET_PARAM_HPP
|
|
|
|
|
2006-09-13 23:56:21 +02:00
|
|
|
#ifdef HAVE_BOOST
|
2005-12-07 11:51:00 +01:00
|
|
|
#include <boost/mpl/if.hpp>
|
|
|
|
#include <boost/type_traits/is_base_and_derived.hpp>
|
2006-09-13 23:56:21 +02:00
|
|
|
#endif
|
2005-12-07 11:51:00 +01:00
|
|
|
|
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
|
2006-09-13 23:56:21 +02:00
|
|
|
struct nil_t { };
|
|
|
|
|
|
|
|
#ifdef HAVE_BOOST
|
2005-12-07 11:51:00 +01:00
|
|
|
template <typename BaseT, typename DefaultT, typename T0, typename T1>
|
|
|
|
struct get_param
|
|
|
|
{
|
|
|
|
typedef typename boost::mpl::if_<
|
|
|
|
boost::is_base_and_derived<BaseT, T0>
|
|
|
|
, T0
|
|
|
|
, typename boost::mpl::if_<
|
|
|
|
boost::is_base_and_derived<BaseT, T1>
|
|
|
|
, T1
|
|
|
|
, DefaultT
|
|
|
|
>::type
|
|
|
|
>::type type;
|
|
|
|
}; // get_param
|
2006-09-13 23:56:21 +02:00
|
|
|
#else
|
|
|
|
template <typename BaseT, typename DefaultT, typename T0, typename T1>
|
|
|
|
struct get_param
|
|
|
|
{
|
|
|
|
typedef T0 type;
|
|
|
|
};
|
|
|
|
#endif
|
2005-12-07 11:51:00 +01:00
|
|
|
|
|
|
|
} // namespace Arabica
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|