numeric_cast_utils.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2003-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/numeric_cast.hpp>
  14. #include <boost/mpl/apply_wrap.hpp>
  15. #include <boost/mpl/aux_/config/forwarding.hpp>
  16. namespace boost { namespace mpl { namespace aux {
  17. template<
  18. typename F
  19. , typename Tag1
  20. , typename Tag2
  21. >
  22. struct cast1st_impl
  23. {
  24. template< typename N1, typename N2 > struct apply
  25. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  26. : apply_wrap2<
  27. F
  28. , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST<Tag1,Tag2>,N1 >::type
  29. , N2
  30. >
  31. {
  32. #else
  33. {
  34. typedef typename apply_wrap2<
  35. F
  36. , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST<Tag1,Tag2>,N1 >::type
  37. , N2
  38. >::type type;
  39. #endif
  40. };
  41. };
  42. template<
  43. typename F
  44. , typename Tag1
  45. , typename Tag2
  46. >
  47. struct cast2nd_impl
  48. {
  49. template< typename N1, typename N2 > struct apply
  50. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  51. : apply_wrap2<
  52. F
  53. , N1
  54. , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST<Tag2,Tag1>,N2 >::type
  55. >
  56. {
  57. #else
  58. {
  59. typedef typename apply_wrap2<
  60. F
  61. , N1
  62. , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST<Tag2,Tag1>,N2 >::type
  63. >::type type;
  64. #endif
  65. };
  66. };
  67. }}}
  68. #endif // BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED