Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
a54b52eb
Commit
a54b52eb
authored
Jan 03, 2016
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nested_for_each(): Keep pointers instead of copies
parent
b9d9bd3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/graph/mpl_nested_loop.hh
src/graph/mpl_nested_loop.hh
+5
-5
No files found.
src/graph/mpl_nested_loop.hh
View file @
a54b52eb
...
...
@@ -67,7 +67,7 @@ struct stop_iteration: public std::exception {};
template
<
class
Action
,
std
::
size_t
N
>
struct
all_any_cast
{
all_any_cast
(
Action
a
,
std
::
array
<
any
,
N
>&
args
)
all_any_cast
(
Action
a
,
std
::
array
<
any
*
,
N
>&
args
)
:
_a
(
a
),
_args
(
args
)
{}
template
<
class
...
Ts
>
...
...
@@ -96,14 +96,14 @@ struct all_any_cast
{
try
{
_a
(
try_any_cast
<
Ts
>
(
_args
[
Idx
])...);
_a
(
try_any_cast
<
Ts
>
(
*
_args
[
Idx
])...);
throw
stop_iteration
();
}
catch
(
bad_any_cast
)
{}
}
Action
_a
;
std
::
array
<
any
,
N
>&
_args
;
std
::
array
<
any
*
,
N
>&
_args
;
};
// recursion-free variadic version of for_each
...
...
@@ -174,9 +174,9 @@ struct inner_loop<Action, std::tuple<Ts...>, TR1, TRS...>
// final function
template
<
class
TR1
,
class
...
TRS
,
class
Action
,
class
...
Args
>
bool
nested_for_each
(
Action
a
,
Args
...
args
)
bool
nested_for_each
(
Action
a
,
Args
&&
...
args
)
{
std
::
array
<
any
,
sizeof
...(
args
)
>
as
{{
args
...}};
std
::
array
<
any
*
,
sizeof
...(
args
)
>
as
{{
&
args
...}};
auto
b
=
all_any_cast
<
Action
,
sizeof
...(
args
)
>
(
a
,
as
);
try
{
...
...
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