Improved portability.

[SVN r1397]
This commit is contained in:
Thomas Witt
2003-07-01 18:47:43 +00:00
parent 405e6ba468
commit 3c0c2b8513
2 changed files with 14 additions and 1 deletions

View File

@@ -125,6 +125,10 @@ namespace boost
mpl::bool_<(function_traits<Function>::arity == 1)> mpl::bool_<(function_traits<Function>::arity == 1)>
{}; {};
template <class T>
struct is_unary_function;
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
template <class T> template <class T>
struct is_unary_function : struct is_unary_function :
mpl::apply_if< is_function<T> mpl::apply_if< is_function<T>
@@ -132,15 +136,21 @@ namespace boost
, mpl::bool_<false> , mpl::bool_<false>
>::type >::type
{}; {};
#endif
} }
// //
// ToDo: Think twice wether enable_if is better than an // ToDo: Think twice whether enable_if is better than an
// static assert. Currently we get convoluted error messages // static assert. Currently we get convoluted error messages
// from the above overload for any pointer that is not a // from the above overload for any pointer that is not a
// pointer to a unary function. // pointer to a unary function.
// //
// If function does not accept function type syntax we are out
// of luck. Ok we can spell it out for <N arguments but that
// really isn't worth the hassle.
//
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class UnaryFunction, class Iterator> template <class UnaryFunction, class Iterator>
typename detail::enable_if< typename detail::enable_if<
detail::is_unary_function<UnaryFunction> detail::is_unary_function<UnaryFunction>
@@ -150,6 +160,7 @@ namespace boost
{ {
return make_transform_iterator(it, function<UnaryFunction>(fun)); return make_transform_iterator(it, function<UnaryFunction>(fun));
} }
#endif
} // namespace boost } // namespace boost

View File

@@ -132,6 +132,7 @@ main()
boost::random_access_readable_iterator_test(i, N, x); boost::random_access_readable_iterator_test(i, N, x);
} }
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
// Test transform_iterator with function pointers // Test transform_iterator with function pointers
{ {
int x[N], y[N]; int x[N], y[N];
@@ -155,6 +156,7 @@ main()
, x); , x);
} }
#endif
// Test transform_iterator as projection iterator // Test transform_iterator as projection iterator
{ {