Commit 6d05ba7b authored by Eike Ziller's avatar Eike Ziller

Algorithm: Fix compilation with Xcode 7.2.1

Change-Id: I4413841adc00156a4c8877c00ba6929262ae8e8f
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent fb4f7e74
......@@ -333,7 +333,7 @@ inserter(QSet<X> &container)
// different container types for input and output, e.g. transforming a QList into a QSet
// function:
template<template<typename, typename...> class C, // result container type
template<template<typename> class C, // result container type
template<typename...> class SC, // input container type
typename F, // function type
typename... SCArgs, // Arguments to SC
......@@ -348,6 +348,22 @@ decltype(auto) transform(const SC<SCArgs...> &container, F function)
return result;
}
template<template<typename, typename> class C, // result container type
template<typename...> class SC, // input container type
typename F, // function type
typename... SCArgs, // Arguments to SC
typename Value = typename SC<SCArgs...>::value_type,
typename Result = std::decay_t<std::result_of_t<F(Value)>>,
typename ResultContainer = C<Result, std::allocator<Result>>>
Q_REQUIRED_RESULT
decltype(auto) transform(const SC<SCArgs...> &container, F function)
{
ResultContainer result;
result.reserve(container.size());
std::transform(std::begin(container), std::end(container), inserter(result), function);
return result;
}
// member function:
template<template<typename...> class C, // result container type
template<typename...> class SC, // input container type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment