Skip to content

Commit

Permalink
Overload isempty method for types.untyped.Set (Issue #561)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Nov 4, 2024
1 parent 95b5e5e commit dca4d11
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion +types/+untyped/Set.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
cnt = obj.Map.Count;
end

% overloads isemty
function tf = isempty(obj)
tf = obj.Count == 0;
end

%overloads size(obj)
function varargout = size(obj, dim)
if nargin > 1
Expand All @@ -80,7 +85,7 @@
varargout{1} = obj.Count;
end
else
if nargout == 1
if nargout == 0 || nargout == 1
varargout{1} = [obj.Count, 1];
else
varargout = num2cell( ones(1, nargout) );
Expand Down

0 comments on commit dca4d11

Please sign in to comment.