Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
d5dff368
Commit
d5dff368
authored
4 years ago
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6cd157fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
std_util.h
jlib/util/std_util.h
+6
-6
No files found.
jlib/util/std_util.h
View file @
d5dff368
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
namespace
jlib
{
namespace
jlib
{
/**
/**
* @brief check if
container c contains
t
* @brief check if
Container contains ElementType
t
* @note C must be a container of type T
* @note C must be a container of type T
*/
*/
template
<
class
C
,
class
T
>
template
<
class
C
ontainer
,
class
ElementType
>
inline
bool
is_contain
(
const
typename
C
&
c
,
const
typename
T
&
t
)
{
bool
is_contain
(
const
typename
Container
&
c
,
const
typename
ElementType
&
t
)
{
for
(
const
auto
&
i
:
c
)
{
for
(
const
auto
&
i
:
c
)
{
if
(
i
==
t
)
{
return
true
;
}
if
(
i
==
t
)
{
return
true
;
}
}
}
...
@@ -23,9 +23,9 @@ inline bool is_contain(const typename C& c, const typename T& t) {
...
@@ -23,9 +23,9 @@ inline bool is_contain(const typename C& c, const typename T& t) {
* @brief Sub 是 All 的子集,返回 All 内 Sub 的补集
* @brief Sub 是 All 的子集,返回 All 内 Sub 的补集
* @note All 和 Sub 必须为同样类型的容器(不支持initializer-list)
* @note All 和 Sub 必须为同样类型的容器(不支持initializer-list)
*/
*/
template
<
class
C
>
template
<
class
C
ontainer
>
inline
typename
C
get_other
(
const
typename
C
&
All
,
const
typename
C
&
Sub
)
{
typename
Container
get_other
(
const
typename
Container
&
All
,
const
typename
Container
&
Sub
)
{
C
res
,
tmp
;
C
ontainer
res
,
tmp
;
std
::
copy
(
Sub
.
begin
(),
Sub
.
end
(),
std
::
back_inserter
(
tmp
));
std
::
copy
(
Sub
.
begin
(),
Sub
.
end
(),
std
::
back_inserter
(
tmp
));
for
(
const
auto
&
i
:
All
)
{
for
(
const
auto
&
i
:
All
)
{
bool
in_Sub
=
false
;
bool
in_Sub
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment