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
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
ffcb2b7c
There was a problem fetching the pipeline summary.
Commit
ffcb2b7c
authored
7 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
fixes in linear set
parent
8f1453db
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
alib2std/src/extensions/linear_set.hpp
+10
-2
10 additions, 2 deletions
alib2std/src/extensions/linear_set.hpp
with
10 additions
and
2 deletions
alib2std/src/extensions/linear_set.hpp
+
10
−
2
View file @
ffcb2b7c
...
@@ -29,7 +29,7 @@ class linear_set {
...
@@ -29,7 +29,7 @@ class linear_set {
void
sort_unique
(
)
{
void
sort_unique
(
)
{
std
::
sort
(
m_data
.
begin
(
),
m_data
.
end
(
),
m_comp
);
std
::
sort
(
m_data
.
begin
(
),
m_data
.
end
(
),
m_comp
);
m_data
.
resize
(
std
::
distance
(
m_data
.
begin
(
),
std
::
unique
(
m_data
.
begin
(
),
m_data
.
end
(
),
std
::
bind
(
&
linear_set
<
int
>::
eq
,
std
::
ref
(
*
this
),
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)
)
)
);
m_data
.
resize
(
std
::
distance
(
m_data
.
begin
(
),
std
::
unique
(
m_data
.
begin
(
),
m_data
.
end
(
),
std
::
bind
(
&
linear_set
<
T
>::
eq
,
std
::
ref
(
*
this
),
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)
)
)
);
}
}
public:
public:
...
@@ -136,8 +136,16 @@ public:
...
@@ -136,8 +136,16 @@ public:
return
m_data
.
erase
(
position
);
return
m_data
.
erase
(
position
);
}
}
size_t
erase
(
const
T
&
val
)
{
const_iterator
position
=
lower_bound
(
val
);
if
(
position
!=
end
(
)
&&
eq
(
*
position
,
val
)
)
return
m_data
.
erase
(
position
),
1
;
else
return
0
;
}
iterator
erase
(
const_iterator
first
,
const_iterator
last
)
{
iterator
erase
(
const_iterator
first
,
const_iterator
last
)
{
return
m_data
.
era
c
e
(
first
,
last
);
return
m_data
.
era
s
e
(
first
,
last
);
}
}
const_iterator
find
(
const
T
&
val
)
const
{
const_iterator
find
(
const
T
&
val
)
const
{
...
...
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