Vcsn  2.4
Be Rational
cast.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <utility> // std::forward
4 
5 namespace vcsn
6 {
7  namespace dyn
8  {
9  namespace detail
10  {
12  template <typename To, typename From>
13  inline
14  To dyn_cast(From&& from)
15  {
16 #ifdef NDEBUG
17  return static_cast<To>(std::forward<From>(from));
18 #else
19  return dynamic_cast<To>(std::forward<From>(from));
20 #endif
21  }
22  }
23  }
24 }
To dyn_cast(From &&from)
A dynamic_cast in debug mode, static_cast with NDEBUG.
Definition: cast.hh:14
Definition: a-star.hh:8