Closed
Bug 617947
Opened 15 years ago
Closed 14 years ago
Merge 'class nsQuickSortComparator' into 'nsTArray'
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: sgautherie, Assigned: dwarfcrank)
References
()
Details
Attachments
(1 file)
|
2.71 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
{
279 // This class exists because VC6 cannot handle static template functions.
280 // Otherwise, the Compare method would be defined directly on nsTArray.
281 template <class E, class Comparator>
282 class nsQuickSortComparator
283 {
284 public:
285 typedef E elem_type;
286 // This function is meant to be used with the NS_QuickSort function. It
287 // maps the callback API expected by NS_QuickSort to the Comparator API
288 // used by nsTArray. See nsTArray::Sort.
289 static int Compare(const void* e1, const void* e2, void *data) {
290 const Comparator* c = reinterpret_cast<const Comparator*>(data);
291 const elem_type* a = static_cast<const elem_type*>(e1);
292 const elem_type* b = static_cast<const elem_type*>(e2);
293 return c->LessThan(*a, *b) ? -1 : (c->Equals(*a, *b) ? 0 : 1);
294 }
295 };
}
Flags: in-testsuite-
| Reporter | ||
Updated•14 years ago
|
Whiteboard: [good first bug][lang=cpp]
Updated•14 years ago
|
Whiteboard: [good first bug][lang=cpp] → [good first bug][lang=c++]
| Reporter | ||
Updated•14 years ago
|
Depends on: 316782
Whiteboard: [good first bug][lang=c++] → [good first bug][mentor=bsmedberg][lang=c++]
| Assignee | ||
Comment 1•14 years ago
|
||
Updated•14 years ago
|
Attachment #606299 -
Flags: review?(benjamin)
Comment 2•14 years ago
|
||
Updated•14 years ago
|
Attachment #606299 -
Flags: review?(benjamin) → review+
Updated•14 years ago
|
Assignee: nobody → matias.juntunen
Keywords: checkin-needed
Comment 3•14 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3e87be93a27d
To make life easier for those checking patches in for you, please follow the directions below for future patches. Thanks!
https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
Keywords: checkin-needed
Target Milestone: --- → mozilla14
Comment 4•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 5•14 years ago
|
||
Comment on attachment 606299 [details] [diff] [review]
Patch to merge nsQuickSortComparator into nsTArray.
Review of attachment 606299 [details] [diff] [review]:
-----------------------------------------------------------------
::: xpcom/glue/nsTArray.h
@@ +1113,5 @@
> //
> // Sorting
> //
> +
> + // This function is meant to be used with the NS_QuickSort function. It
Nit: this is now a method, not a function anymore.
| Reporter | ||
Updated•14 years ago
|
Whiteboard: [good first bug][mentor=bsmedberg][lang=c++]
You need to log in
before you can comment on or make changes to this bug.
Description
•