#include <boost\type_traits\remove_cv.hpp>
#include <boost\type_traits\is_same.hpp>
#include <boost\type_traits\remove_pointer.hpp>
#include <boost\type_traits\is_arithmetic.hpp>
#include <boost\utility\enable_if.hpp>
namespace detail
{
struct tag
{
template < typename _T >
tag(const _T &);
};
// This operator will be used if there is no 'real' operator
tag operator*(const tag &);
// This is need in case of operator * return type is void
tag operator,(tag, int);
unsigned char (&helper(tag))[2];
template < typename _T >
unsigned char helper(const _T &);
template < typename _T, typename _Enable = void >
struct traits
{
static const bool value = (sizeof(helper(((**static_cast <_T*>(NULL)), 0))) == 1);
};
// specialization for void pointers
template < typename _T >
struct traits < _T,
typename boost::enable_if < typename boost::is_same < typename boost::remove_cv < typename boost::remove_pointer < _T > ::type > ::type, void > > ::type >
{
static const bool value = false;
};
// specialization for arithmetic types
template < typename _T >
struct traits < _T,
typename boost::enable_if < typename boost::is_arithmetic < typename boost::remove_cv < _T > ::type > > ::type >
{
static const bool value = false;
};
}
template < typename _T >
struct is_dereferenceable :
public detail::traits < _T >
{ };
I have tested it in msvs 2008