forked from boostorg/type_traits
rolled back g++ fix, since it didn't work
[SVN r8832]
This commit is contained in:
@ -10,8 +10,6 @@
|
||||
// see libs/utility/type_traits.htm
|
||||
|
||||
/* Release notes:
|
||||
31 Jan 2001:
|
||||
Fixes for is_convertible with g++. (Jeremy Siek)
|
||||
21 Jan 2001:
|
||||
Fixed tests for long long to detect its presence on GCC (David Abrahams)
|
||||
03 Oct 2000:
|
||||
@ -470,51 +468,13 @@ template <typename T, std::size_t sz> struct is_POD<T[sz]>
|
||||
|
||||
//
|
||||
// is one type convertable to another?
|
||||
#if defined(__GNUC__)
|
||||
template <bool isPOD_or_nonclass, class From, class To>
|
||||
struct is_convertible_dispatch {
|
||||
typedef char (&no)[1];
|
||||
typedef char (&yes)[2];
|
||||
template <class T>
|
||||
struct checker {
|
||||
static no check(...);
|
||||
static yes check(T);
|
||||
};
|
||||
static From from;
|
||||
static const bool value = sizeof( checker<To>::check(from) ) == sizeof(yes);
|
||||
};
|
||||
template <class From, class To>
|
||||
struct is_convertible_dispatch<false, From, To> {
|
||||
typedef char (&no)[1];
|
||||
typedef char (&yes)[2];
|
||||
template <class T>
|
||||
struct checker {
|
||||
static no check(void*);
|
||||
static yes check(T*);
|
||||
};
|
||||
static From from;
|
||||
static const bool value = sizeof( checker<To>::check(&from) ) == sizeof(yes);
|
||||
};
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
private:
|
||||
typedef is_convertible_dispatch<is_POD<From>::value
|
||||
|| !BOOST_IS_CLASS(From) || is_reference<From>::value, From, To> Dispatch;
|
||||
public:
|
||||
static const bool value = Dispatch::value;
|
||||
};
|
||||
|
||||
#else // not __GNUC__
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
private:
|
||||
typedef char (&no)[1];
|
||||
typedef char (&yes)[2];
|
||||
# if defined(__BORLANDC__)
|
||||
# if defined(__BORLANDC__) || defined(__GNUC__)
|
||||
// This workaround for Borland breaks the EDG C++ frontend,
|
||||
// so we only use it for Borland.
|
||||
template <class T>
|
||||
@ -535,7 +495,6 @@ public:
|
||||
# endif
|
||||
void foo(); // avoid warning about all members being private
|
||||
};
|
||||
#endif // not __GNUC__
|
||||
|
||||
template <class From>
|
||||
struct is_convertible<From, void>
|
||||
|
Reference in New Issue
Block a user