Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Hello
GitLab will be updated tonight at 22:00. Expect short outage.
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
34eec775
Commit
34eec775
authored
5 years ago
by
Jan Trávníček
Committed by
Tomáš Pecka
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
improve ext tree comparison
parent
1f554ac4
No related branches found
No related tags found
1 merge request
!119
Merge jt
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
alib2std/src/extensions/container/tree.hpp
+6
-13
6 additions, 13 deletions
alib2std/src/extensions/container/tree.hpp
with
6 additions
and
13 deletions
alib2std/src/extensions/container/tree.hpp
+
6
−
13
View file @
34eec775
...
...
@@ -34,6 +34,8 @@
#include
<extensions/compare.hpp>
#include
<extensions/iterator.hpp>
#include
"tuple.hpp"
namespace
ext
{
/**
...
...
@@ -1138,21 +1140,12 @@ public:
*
positive
if
this
instance
is
bigger
than
\
p
other
instance
*/
int
compare
(
const
tree
&
other
)
const
{
static
ext
::
compare
<
typename
std
::
decay
<
T
>::
type
>
comp
;
auto
iterF
=
this
->
prefix_begin
(
);
auto
iterS
=
other
.
prefix_begin
(
);
for
(
;
iterF
!=
this
->
prefix_end
(
)
||
iterS
!=
other
.
prefix_end
(
);
++
iterF
,
++
iterS
)
{
int
res
=
comp
(
*
iterF
,
*
iterS
);
if
(
res
!=
0
)
return
res
;
}
if
(
iterF
!=
this
->
prefix_end
(
)
)
return
-
1
;
auto
first
=
ext
::
tie
(
this
->
getData
(
),
this
->
getChildren
(
)
);
auto
second
=
ext
::
tie
(
other
.
getData
(
),
other
.
getChildren
(
)
);
if
(
iterS
!=
other
.
prefix_end
(
)
)
return
1
;
static
ext
::
compare
<
decltype
(
first
)
>
comp
;
return
0
;
return
comp
(
first
,
second
)
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment