- changed milestone to 1.2
- changed component to Base.Collections
-
assigned issue to
TEnumerableBase<T>.Min(const comparer: IComparer<T>) uses fComparer instead of comparer
Issue #195
resolved
The following function (line 846 in Spring.Collections.Base.pas) uses the fComparer from TEnumerableBase<T> instead of the one passed to the function. Line 860 should be
if comparer.Compare(item, Result) < 0 then
instead of
if fComparer.Compare(item, Result) < 0 then
function TEnumerableBase<T>.Min(const comparer: IComparer<T>): T;
var
flag: Boolean;
item: T;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(Assigned(comparer), 'comparer');
{$ENDIF}
flag := False;
for item in Self do
begin
if flag then
begin
if fComparer.Compare(item, Result) < 0 then
Result := item;
end
else
begin
flag := True;
Result := item;
end;
end;
if not flag then
raise EInvalidOperationException.CreateRes(@SSequenceContainsNoElements);
end;
Comments (4)
-
repo owner -
repo owner - changed status to resolved
fixed issue
#195→ <<cset df0e89ec6df5>>
-
repo owner fixed issue
#195→ <<cset e563b3fddab5>>
-
repo owner fixed issue
#195→ <<cset 8f66bc44940a>>
- Log in to comment