Advertisement
Brick

union_cast

May 28th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.15 KB | None | 0 0
  1. template <typename In, typename Out>
  2. inline Out union_cast(In in)
  3. {
  4.     union union_caster { In in; Out out; };
  5.  
  6.     return union_caster { in }.out;
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement