Support assignment from 0, construction from 0, and comparison to zero.

[SVN r16174]
This commit is contained in:
Douglas Gregor
2002-11-09 16:02:47 +00:00
parent 4fed545468
commit 17b311cbbd
5 changed files with 126 additions and 12 deletions

View File

@ -27,13 +27,13 @@
#include <boost/ref.hpp>
#include <boost/pending/ct_if.hpp>
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_NO_CONFIG)
# define BOOST_FUNCTION_TARGET_FIX(x) x
#else
# define BOOST_FUNCTION_TARGET_FIX(x)
#endif // not MSVC
#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_NO_CONFIG)
// Work around a compiler bug.
// boost::python::objects::function has to be seen by the compiler before the
// boost::function class template.
@ -42,6 +42,12 @@ namespace boost { namespace python { namespace objects {
}}}
#endif
// GCC 3.2 doesn't seem to support enable_if, so we assume that
// earlier versions have the same limitation
#if defined(__GNUC__) && __GNUC__ < 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ <= 2 ) && !(BOOST_NO_CONFIG)
# define BOOST_FUNCTION_NO_ENABLE_IF
#endif
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace boost {
@ -253,6 +259,30 @@ namespace boost {
return manager(functor_ptr, op, tag_type());
}
};
template<bool>
struct enabled
{
template<typename T>
struct base
{
typedef T type;
};
};
template<>
struct enabled<false>
{
template<typename T>
struct base
{
};
};
template<bool Enabled, typename T>
struct enable_if : public enabled<Enabled>::template base<T>
{
};
} // end namespace function
} // end namespace detail