diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 909f32a609d..faa72a5ac02 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -140,8 +140,7 @@ typename T::value_type findOrDefault(const T &container, R (S::*function)() cons // find helpers ////////////////// template -auto equal(R (S::*function)() const, T value) - -> decltype(std::bind(std::equal_to(), value, std::bind(function, std::placeholders::_1))) +decltype(auto) equal(R (S::*function)() const, T value) { // This should use std::equal_to<> instead of std::eqaul_to, // but that's not supported everywhere yet, since it is C++14 @@ -149,8 +148,7 @@ auto equal(R (S::*function)() const, T value) } template -auto equal(R S::*member, T value) - -> decltype(std::bind(std::equal_to(), value, std::bind(member, std::placeholders::_1))) +decltype(auto) equal(R S::*member, T value) { return std::bind(std::equal_to(), value, std::bind(member, std::placeholders::_1)); } @@ -262,8 +260,7 @@ struct TransformImpl { template Q_REQUIRED_RESULT -auto transform(const C &container, F function) --> typename ContainerType::template ResultOfTransform +decltype(auto) transform(const C &container, F function) { return TransformImpl< typename ContainerType::template ResultOfTransform, @@ -276,8 +273,7 @@ template Q_REQUIRED_RESULT -auto transform(const C &container, R (S::*p)() const) - ->typename ContainerType::template ResultOfTransformPMF +decltype(auto) transform(const C &container, R (S::*p)() const) { return TransformImpl< typename ContainerType::template ResultOfTransformPMF, @@ -290,8 +286,7 @@ template class C, // result container type typename SC, // input container type typename F> // function type Q_REQUIRED_RESULT -auto transform(const SC &container, F function) - -> typename ContainerType::template ResultOfTransform +decltype(auto) transform(const SC &container, F function) { return TransformImpl< typename ContainerType::template ResultOfTransform, @@ -306,8 +301,7 @@ template class C, // result container type typename R, typename S> Q_REQUIRED_RESULT -auto transform(const SC &container, R (S::*p)() const) - -> C> +decltype(auto) transform(const SC &container, R (S::*p)() const) { return TransformImpl< C>,