forked from boostorg/iterator
Improved portability.
[SVN r1397]
This commit is contained in:
@@ -125,6 +125,10 @@ namespace boost
|
||||
mpl::bool_<(function_traits<Function>::arity == 1)>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_unary_function;
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
template <class T>
|
||||
struct is_unary_function :
|
||||
mpl::apply_if< is_function<T>
|
||||
@@ -132,15 +136,21 @@ namespace boost
|
||||
, mpl::bool_<false>
|
||||
>::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
|
||||
// from the above overload for any pointer that is not a
|
||||
// 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>
|
||||
typename detail::enable_if<
|
||||
detail::is_unary_function<UnaryFunction>
|
||||
@@ -150,6 +160,7 @@ namespace boost
|
||||
{
|
||||
return make_transform_iterator(it, function<UnaryFunction>(fun));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -132,6 +132,7 @@ main()
|
||||
boost::random_access_readable_iterator_test(i, N, x);
|
||||
}
|
||||
|
||||
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
// Test transform_iterator with function pointers
|
||||
{
|
||||
int x[N], y[N];
|
||||
@@ -155,6 +156,7 @@ main()
|
||||
, x);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// Test transform_iterator as projection iterator
|
||||
{
|
||||
|
Reference in New Issue
Block a user