Commit 8f5f8cff authored by Anton Bukov's avatar Anton Bukov

Fix compiler loop on avg and sum

parent 06f47fd6
...@@ -266,7 +266,7 @@ namespace boolinq { ...@@ -266,7 +266,7 @@ namespace boolinq {
T value = tuple.linq.next(); T value = tuple.linq.next();
_TKey key = apply(value); _TKey key = apply(value);
if (tuple.set.insert(key).second) { if (tuple.set.insert(key).second) {
return std::make_pair(key, tuple.linqCopy.where([apply, key](T &v){ return std::make_pair(key, tuple.linqCopy.where([apply, key](T v){
return apply(v) == key; return apply(v) == key;
})); }));
} }
...@@ -388,7 +388,7 @@ namespace boolinq { ...@@ -388,7 +388,7 @@ namespace boolinq {
template<typename TRet = T> template<typename TRet = T>
TRet sum() const TRet sum() const
{ {
return cast<TRet>().sum(); return sum([](T value) { return TRet(value); });
} }
template<typename F, typename _TRet = typename std::result_of<F(T)>::type> template<typename F, typename _TRet = typename std::result_of<F(T)>::type>
...@@ -405,7 +405,7 @@ namespace boolinq { ...@@ -405,7 +405,7 @@ namespace boolinq {
template<typename TRet = T> template<typename TRet = T>
TRet avg() const TRet avg() const
{ {
return cast<TRet>().avg(); return avg([](T value) { return TRet(value); });
} }
int count() const int count() const
......
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