Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
3dfbb30d
Commit
3dfbb30d
authored
Jan 13, 2016
by
Tiago Peixoto
Browse files
nested_for_each(): isolate boost::any_cast<>
parent
4fa837b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/mpl_nested_loop.hh
View file @
3dfbb30d
...
...
@@ -77,6 +77,8 @@ struct all_any_cast
dispatch
(
std
::
make_index_sequence
<
sizeof
...(
Ts
)
>
(),
vs
...);
}
struct
fail_cast
{};
template
<
class
T
>
T
&
try_any_cast
(
boost
::
any
&
a
)
const
{
...
...
@@ -84,9 +86,16 @@ struct all_any_cast
{
return
any_cast
<
T
&>
(
a
);
}
catch
(
bad_any_cast
)
catch
(
bad_any_cast
&
)
{
return
any_cast
<
std
::
reference_wrapper
<
T
>>
(
a
);
try
{
return
any_cast
<
std
::
reference_wrapper
<
T
>>
(
a
);
}
catch
(
bad_any_cast
&
)
{
throw
fail_cast
();
}
}
}
...
...
@@ -99,7 +108,7 @@ struct all_any_cast
_a
(
try_any_cast
<
Ts
>
(
*
_args
[
Idx
])...);
throw
stop_iteration
();
}
catch
(
bad_any
_cast
)
{}
catch
(
fail
_cast
)
{}
}
Action
_a
;
...
...
Write
Preview
Supports
Markdown
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