Bug 78158 - add a function for summing an array of values
Summary: add a function for summing an array of values
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tony Chang
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 15:11 PST by Tony Chang
Modified: 2012-02-22 10:01 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.52 KB, patch)
2012-02-08 15:13 PST, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2012-02-08 15:11:56 PST
add a function for summing an array of values
Comment 1 Tony Chang 2012-02-08 15:13:04 PST
Created attachment 126161 [details]
Patch
Comment 2 Tony Chang 2012-02-08 15:14:18 PST
I wasn't sure if it was OK to use std::accumulate from <numeric>. If it is OK, then I'm happy to throw away this patch.

Or perhaps I should just write the for loop in my code (I wanted to sum a WTF::Vector<LayoutUnit>).
Comment 3 Eric Seidel (no email) 2012-02-08 15:28:04 PST
Next thing I know you're gonna have us using map/reduce in our code! ;p
Comment 4 Hajime Morrita 2012-02-20 21:09:10 PST
And this is a good opportunity to utilize TestWebKitAPI ;-)
Comment 5 Tony Chang 2012-02-21 12:02:37 PST
Comment on attachment 126161 [details]
Patch

I don't need this patch anymore, but maybe someone else who wants it can resurrect it with a test.
Comment 6 Alexey Proskuryakov 2012-02-21 17:33:35 PST
It should be fine to use std::accumulate - the parts of STL we stay shy of is those that can raise exceptions.
Comment 7 Tony Chang 2012-02-22 10:01:31 PST
Sounds good, I'll use std::accumulate in the future.