blob: 6021fefc3fb6e099f1a3ca7e0d9f4cc91d468de6 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
Jeff Thompson3d613fd2013-10-15 15:39:04 -07002#ifndef NDNBOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED
3#define NDNBOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -07004
5// Copyright Aleksey Gurtovoy 2003-2004
6//
7// Distributed under the Boost Software License, Version 1.0.
8// (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// See http://www.boost.org/libs/mpl for documentation.
12
13// $Id: numeric_cast_utils.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $
15// $Revision: 49267 $
16
17#include <ndnboost/mpl/numeric_cast.hpp>
18#include <ndnboost/mpl/apply_wrap.hpp>
19#include <ndnboost/mpl/aux_/config/forwarding.hpp>
20
21namespace ndnboost { namespace mpl { namespace aux {
22
23template<
24 typename F
25 , typename Tag1
26 , typename Tag2
27 >
28struct cast1st_impl
29{
30 template< typename N1, typename N2 > struct apply
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031#if !defined(NDNBOOST_MPL_CFG_NO_NESTED_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -070032 : apply_wrap2<
33 F
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034 , typename apply_wrap1< NDNBOOST_MPL_AUX_NUMERIC_CAST<Tag1,Tag2>,N1 >::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070035 , N2
36 >
37 {
38#else
39 {
40 typedef typename apply_wrap2<
41 F
Jeff Thompson3d613fd2013-10-15 15:39:04 -070042 , typename apply_wrap1< NDNBOOST_MPL_AUX_NUMERIC_CAST<Tag1,Tag2>,N1 >::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070043 , N2
44 >::type type;
45#endif
46 };
47};
48
49template<
50 typename F
51 , typename Tag1
52 , typename Tag2
53 >
54struct cast2nd_impl
55{
56 template< typename N1, typename N2 > struct apply
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057#if !defined(NDNBOOST_MPL_CFG_NO_NESTED_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -070058 : apply_wrap2<
59 F
60 , N1
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061 , typename apply_wrap1< NDNBOOST_MPL_AUX_NUMERIC_CAST<Tag2,Tag1>,N2 >::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070062 >
63 {
64#else
65 {
66 typedef typename apply_wrap2<
67 F
68 , N1
Jeff Thompson3d613fd2013-10-15 15:39:04 -070069 , typename apply_wrap1< NDNBOOST_MPL_AUX_NUMERIC_CAST<Tag2,Tag1>,N2 >::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070070 >::type type;
71#endif
72 };
73};
74
75}}}
76
Jeff Thompson3d613fd2013-10-15 15:39:04 -070077#endif // NDNBOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED