1.. Metafunctions/Bitwise Operations//bitand_ 2 3bitand\_ 4======== 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename T1 13 , typename T2 14 , typename T3 = |unspecified| 15 |...| 16 , typename T\ *n* = |unspecified| 17 > 18 struct bitand\_ 19 { 20 typedef |unspecified| type; 21 }; 22 23 24 25Description 26----------- 27 28Returns the result of *bitwise and* (``&``) operation of its arguments. 29 30 31Header 32------ 33 34.. parsed-literal:: 35 36 #include <boost/mpl/bitand.hpp> 37 #include <boost/mpl/bitwise.hpp> 38 39 40Model of 41-------- 42 43|Numeric Metafunction| 44 45 46Parameters 47---------- 48 49+---------------+---------------------------+-----------------------------------------------+ 50| Parameter | Requirement | Description | 51+===============+===========================+===============================================+ 52| |T1...Tn| | |Integral Constant| | Operation's arguments. | 53+---------------+---------------------------+-----------------------------------------------+ 54 55|Note:| |numeric metafunction note| |-- end note| 56 57 58Expression semantics 59-------------------- 60 61For any |Integral Constant|\ s |c1...cn|: 62 63 64.. parsed-literal:: 65 66 typedef bitand_<c1,\ |...|\ c\ *n*\>::type r; 67 68:Return type: 69 |Integral Constant|. 70 71:Semantics: 72 Equivalent to 73 74 .. parsed-literal:: 75 76 typedef integral_c< 77 typeof(c1::value & c2::value) 78 , ( c1::value & c2::value ) 79 > c; 80 81 typedef bitand_<c,c3,\ |...|\c\ *n*\>::type r; 82 83.. .......................................................................... 84 85.. parsed-literal:: 86 87 typedef bitand_<c1,\ |...|\ c\ *n*\> r; 88 89:Return type: 90 |Integral Constant|. 91 92:Semantics: 93 Equivalent to 94 95 .. parsed-literal:: 96 97 struct r : bitand_<c1,\ |...|\ c\ *n*\>::type {}; 98 99 100Complexity 101---------- 102 103Amortized constant time. 104 105 106Example 107------- 108 109.. parsed-literal:: 110 111 typedef integral_c<unsigned,0> u0; 112 typedef integral_c<unsigned,1> u1; 113 typedef integral_c<unsigned,2> u2; 114 typedef integral_c<unsigned,8> u8; 115 typedef integral_c<unsigned,0xffffffff> uffffffff; 116 117 BOOST_MPL_ASSERT_RELATION( (bitand_<u0,u0>::value), ==, 0 ); 118 BOOST_MPL_ASSERT_RELATION( (bitand_<u1,u0>::value), ==, 0 ); 119 BOOST_MPL_ASSERT_RELATION( (bitand_<u0,u1>::value), ==, 0 ); 120 BOOST_MPL_ASSERT_RELATION( (bitand_<u0,uffffffff>::value), ==, 0 ); 121 BOOST_MPL_ASSERT_RELATION( (bitand_<u1,uffffffff>::value), ==, 1 ); 122 BOOST_MPL_ASSERT_RELATION( (bitand_<u8,uffffffff>::value), ==, 8 ); 123 124 125See also 126-------- 127 128|Bitwise Operations|, |Numeric Metafunction|, |numeric_cast|, |bitor_|, |bitxor_|, |shift_left| 129 130 131.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 132 Distributed under the Boost Software License, Version 1.0. (See accompanying 133 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 134