Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
mlz
BornAgain
Commits
cc4e2a69
Commit
cc4e2a69
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
OwningVector + fcts index_of, swap
parent
a45caa59
No related branches found
No related tags found
1 merge request
!2370
cleanup and prepare refactoring in MasksSet context
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Base/Types/OwningVector.h
+19
-1
19 additions, 1 deletion
Base/Types/OwningVector.h
with
19 additions
and
1 deletion
Base/Types/OwningVector.h
+
19
−
1
View file @
cc4e2a69
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#define BORNAGAIN_BASE_TYPES_OWNINGVECTOR_H
#define BORNAGAIN_BASE_TYPES_OWNINGVECTOR_H
#include
"Base/Util/Assert.h"
#include
"Base/Util/Assert.h"
#include
<algorithm>
#include
<cstddef>
#include
<cstddef>
#include
<utility>
#include
<utility>
#include
<vector>
#include
<vector>
...
@@ -58,6 +59,14 @@ public:
...
@@ -58,6 +59,14 @@ public:
T
*
const
&
at
(
int
i
)
const
{
return
m_v
.
at
(
i
);
}
T
*
const
&
at
(
int
i
)
const
{
return
m_v
.
at
(
i
);
}
T
*
const
&
front
()
const
{
return
m_v
.
front
();
}
T
*
const
&
front
()
const
{
return
m_v
.
front
();
}
T
*
const
&
back
()
const
{
return
m_v
.
back
();
}
T
*
const
&
back
()
const
{
return
m_v
.
back
();
}
int
index_of
(
const
T
*
t
)
const
{
for
(
size_t
i
=
0
;
i
<
m_v
.
size
();
i
++
)
if
(
m_v
[
i
]
==
t
)
return
int
(
i
);
return
-
1
;
}
void
delete_element
(
T
*
e
)
void
delete_element
(
T
*
e
)
{
{
...
@@ -113,7 +122,16 @@ public:
...
@@ -113,7 +122,16 @@ public:
return
result
;
return
result
;
}
}
const
std
::
vector
<
const
T
*>&
reference
()
const
{
return
m_v
;
}
void
swap
(
size_t
fromIndex
,
size_t
toIndex
)
{
if
(
fromIndex
>
toIndex
)
std
::
rotate
(
m_v
.
rend
()
-
fromIndex
-
1
,
m_v
.
rend
()
-
fromIndex
,
m_v
.
rend
()
-
toIndex
);
else
std
::
rotate
(
m_v
.
begin
()
+
fromIndex
,
m_v
.
begin
()
+
fromIndex
+
1
,
m_v
.
begin
()
+
toIndex
+
1
);
}
const
std
::
vector
<
T
*>&
shared
()
const
{
return
m_v
;
}
std
::
vector
<
const
T
*>
const_vector
()
const
std
::
vector
<
const
T
*>
const_vector
()
const
{
{
const
std
::
vector
<
const
T
*>
result
(
m_v
.
begin
(),
m_v
.
end
());
const
std
::
vector
<
const
T
*>
result
(
m_v
.
begin
(),
m_v
.
end
());
...
...
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