reduce number of template instantiations

[SVN r53566]
This commit is contained in:
Eric Niebler
2009-06-02 05:46:21 +00:00
parent f0b6c8b1e2
commit 6447c5371e
3 changed files with 54 additions and 56 deletions

View File

@@ -7,12 +7,8 @@
#if !defined(FUSION_ACCESS_04182005_0737)
#define FUSION_ACCESS_04182005_0737
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_cv.hpp>
namespace boost { namespace fusion { namespace detail
{
@@ -33,22 +29,35 @@ namespace boost { namespace fusion { namespace detail
};
template <typename T>
struct non_ref_parameter
struct call_param
{
typedef typename boost::remove_cv<T>::type const& type;
typedef T const& type;
};
template <typename T>
struct call_param
struct call_param<T &>
{
typedef typename
mpl::eval_if<
is_reference<T>
, mpl::identity<T>
, non_ref_parameter<T>
>::type
type;
typedef T& type;
};
template <typename T>
struct call_param<T const>
{
typedef T const& type;
};
template <typename T>
struct call_param<T volatile>
{
typedef T const& type;
};
template <typename T>
struct call_param<T const volatile>
{
typedef T const& type;
};
}}}
#endif