blob: 0185ebf8673e652a1c6c447173e44f5affc81f0a [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
2// Copyright Aleksey Gurtovoy 2000-2004
3//
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8
9// Preprocessed version of "ndnboost/mpl/modulus.hpp" header
10// -- DO NOT modify by hand!
11
12namespace ndnboost { namespace mpl {
13
14template<
15 typename Tag1
16 , typename Tag2
17
Jeff Thompson3d613fd2013-10-15 15:39:04 -070018 , NDNBOOST_MPL_AUX_NTTP_DECL(int, tag1_) = NDNBOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
19 , NDNBOOST_MPL_AUX_NTTP_DECL(int, tag2_) = NDNBOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
Jeff Thompsona28eed82013-08-22 16:21:10 -070020 >
21struct modulus_impl
22 : if_c<
23 ( tag1_ > tag2_ )
24 , aux::cast2nd_impl< modulus_impl< Tag1,Tag1 >,Tag1, Tag2 >
25 , aux::cast1st_impl< modulus_impl< Tag2,Tag2 >,Tag1, Tag2 >
26 >::type
27{
28};
29
30/// for Digital Mars C++/compilers with no CTPS/TTP support
31template<> struct modulus_impl< na,na >
32{
33 template< typename U1, typename U2 > struct apply
34 {
35 typedef apply type;
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036 NDNBOOST_STATIC_CONSTANT(int, value = 0);
Jeff Thompsona28eed82013-08-22 16:21:10 -070037 };
38};
39
40template<> struct modulus_impl< na,integral_c_tag >
41{
42 template< typename U1, typename U2 > struct apply
43 {
44 typedef apply type;
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045 NDNBOOST_STATIC_CONSTANT(int, value = 0);
Jeff Thompsona28eed82013-08-22 16:21:10 -070046 };
47};
48
49template<> struct modulus_impl< integral_c_tag,na >
50{
51 template< typename U1, typename U2 > struct apply
52 {
53 typedef apply type;
Jeff Thompson3d613fd2013-10-15 15:39:04 -070054 NDNBOOST_STATIC_CONSTANT(int, value = 0);
Jeff Thompsona28eed82013-08-22 16:21:10 -070055 };
56};
57
58template< typename T > struct modulus_tag
59{
60 typedef typename T::tag type;
61};
62
63template<
Jeff Thompson3d613fd2013-10-15 15:39:04 -070064 typename NDNBOOST_MPL_AUX_NA_PARAM(N1)
65 , typename NDNBOOST_MPL_AUX_NA_PARAM(N2)
Jeff Thompsona28eed82013-08-22 16:21:10 -070066 >
67struct modulus
68 : aux::msvc_eti_base< typename apply_wrap2<
69 modulus_impl<
70 typename modulus_tag<N1>::type
71 , typename modulus_tag<N2>::type
72 >
73 , N1
74 , N2
75 >::type >::type
76
77{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070078 NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(2, modulus, (N1, N2))
Jeff Thompsona28eed82013-08-22 16:21:10 -070079
80};
81
Jeff Thompson3d613fd2013-10-15 15:39:04 -070082NDNBOOST_MPL_AUX_NA_SPEC2(2, 2, modulus)
Jeff Thompsona28eed82013-08-22 16:21:10 -070083
84}}
85
86namespace ndnboost { namespace mpl {
87
88namespace aux {
89template< typename T, T n1, T n2 >
90struct modulus_wknd
91{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070092 NDNBOOST_STATIC_CONSTANT(T, value = (n1 % n2));
Jeff Thompsona28eed82013-08-22 16:21:10 -070093 typedef integral_c< T,value > type;
94};
95
96}
97
98template<>
99struct modulus_impl< integral_c_tag,integral_c_tag >
100{
101 template< typename N1, typename N2 > struct apply
102 : aux::modulus_wknd<
103 typename aux::largest_int<
104 typename N1::value_type
105 , typename N2::value_type
106 >::type
107 , N1::value
108 , N2::value
109 >::type
110
111 {
112 };
113};
114
115}}