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
ce55f593
Commit
ce55f593
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
rm unused Base::algo::concat
parent
f9fae54d
No related branches found
No related tags found
1 merge request
!1638
rename BaseUtil -> Base, and minor cleanup
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Base/Util/Algorithms.h
+0
-16
0 additions, 16 deletions
Base/Util/Algorithms.h
Tests/Unit/Base/Concat.cpp
+0
-34
0 additions, 34 deletions
Tests/Unit/Base/Concat.cpp
with
0 additions
and
50 deletions
Base/Util/Algorithms.h
+
0
−
16
View file @
ce55f593
...
...
@@ -34,22 +34,6 @@ inline bool almostEqual(double a, double b, int ulp)
return
std
::
abs
(
a
-
b
)
<=
eps
*
ulp
*
(
std
::
abs
(
a
)
+
std
::
abs
(
b
))
/
2
;
}
//! Returns the concatenation of two std::vector%s.
template
<
class
T
>
std
::
vector
<
T
>
concat
(
const
std
::
vector
<
T
>&
v1
,
const
std
::
vector
<
T
>&
v2
);
}
// namespace Base::algo
// ************************************************************************************************
// Implementation
// ************************************************************************************************
template
<
class
T
>
std
::
vector
<
T
>
Base
::
algo
::
concat
(
const
std
::
vector
<
T
>&
v1
,
const
std
::
vector
<
T
>&
v2
)
{
std
::
vector
<
T
>
v
=
v1
;
v
.
insert
(
v
.
end
(),
v2
.
begin
(),
v2
.
end
());
return
v
;
}
#endif // BORNAGAIN_BASE_UTIL_ALGORITHMS_H
This diff is collapsed.
Click to expand it.
Tests/Unit/Base/Concat.cpp
deleted
100644 → 0
+
0
−
34
View file @
f9fae54d
#include
"Base/Util/Algorithms.h"
#include
"Tests/GTestWrapper/google_test.h"
#include
<string>
#include
<vector>
TEST
(
ConcatTest
,
SimpleType
)
{
std
::
vector
<
int
>
A
{
1
,
2
,
3
};
std
::
vector
<
int
>
B
{
4
,
5
};
std
::
vector
<
int
>
N
;
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
B
),
(
std
::
vector
<
int
>
{
1
,
2
,
3
,
4
,
5
}));
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
A
),
(
std
::
vector
<
int
>
{
1
,
2
,
3
,
1
,
2
,
3
}));
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
N
),
A
);
EXPECT_EQ
(
Base
::
algo
::
concat
(
N
,
B
),
B
);
}
TEST
(
ConcatTest
,
Struct
)
{
struct
S
{
std
::
string
nam
;
double
val
;
bool
operator
==
(
const
S
&
o
)
const
{
return
nam
==
o
.
nam
&&
val
==
o
.
val
;
}
};
using
V
=
std
::
vector
<
S
>
;
V
A
{{
"a"
,
11.
}};
V
B
{{
"b"
,
2.
},
{
"c"
,
.3
}};
V
N
;
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
B
),
(
V
{{
"a"
,
11.
},
{
"b"
,
2.
},
{
"c"
,
.3
}}));
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
A
),
(
V
{{
"a"
,
11.
},
{
"a"
,
11.
}}));
EXPECT_EQ
(
Base
::
algo
::
concat
(
A
,
N
),
A
);
EXPECT_EQ
(
Base
::
algo
::
concat
(
N
,
B
),
B
);
}
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