Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-util
Commits
b3489362
Commit
b3489362
authored
Nov 24, 2014
by
Florent Lamiraux
Browse files
Add a macro to static cast with dynamic cast checking in debug mode.
parent
b885e4dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/hpp/util/pointer.hh
View file @
b3489362
...
...
@@ -37,5 +37,14 @@
# define HPP_STATIC_PTR_CAST(t, x) boost::static_pointer_cast < t > (x)
# define HPP_DYNAMIC_PTR_CAST(t, x) boost::dynamic_pointer_cast < t > (x)
# ifndef NDEBUG
# define HPP_STATIC_CAST_REF_CHECK(t, x)\
try {\
dynamic_cast < t& > (x);\
} catch (const std::exception& exc) {\
assert ("Cast in #t failed" && 0);\
}
# else
# define HPP_STATIC_CAST_REF_CHECK(t, x)
# endif // defined NDEBUG
#endif //! HPP_UTIL_POINTER_HH
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment