1 .. Metafunctions/Bitwise Operations//shift_right
17 typedef |unspecified| type;
25 Returns the result of bitwise *shift right* (``>>``) operation on ``T``.
33 #include <boost/mpl/shift_right.hpp>
34 #include <boost/mpl/bitwise.hpp>
40 |Numeric Metafunction|
46 +---------------+-------------------------------+---------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===============================+===========================+
49 | ``T`` | |Integral Constant| | A value to shift. |
50 +---------------+-------------------------------+---------------------------+
51 | ``Shift`` | Unsigned |Integral Constant| | A shift distance. |
52 +---------------+-------------------------------+---------------------------+
54 |Note:| |numeric metafunction note| |-- end note|
60 For arbitrary |Integral Constant| ``c`` and unsigned |Integral Constant| ``shift``:
65 typedef shift_right<c,shift>::type r;
77 , ( c::value >> shift::value )
80 .. ..........................................................................
84 typedef shift_right<c,shift> r;
94 struct r : shift_right<c,shift>::type {};
100 Amortized constant time.
108 typedef integral_c<unsigned,0> u0;
109 typedef integral_c<unsigned,1> u1;
110 typedef integral_c<unsigned,2> u2;
111 typedef integral_c<unsigned,8> u8;
113 BOOST_MPL_ASSERT_RELATION( (shift_right<u0,u0>::value), ==, 0 );
114 BOOST_MPL_ASSERT_RELATION( (shift_right<u1,u0>::value), ==, 1 );
115 BOOST_MPL_ASSERT_RELATION( (shift_right<u1,u1>::value), ==, 0 );
116 BOOST_MPL_ASSERT_RELATION( (shift_right<u2,u1>::value), ==, 1 );
117 BOOST_MPL_ASSERT_RELATION( (shift_right<u8,u1>::value), ==, 4 );
123 |Bitwise Operations|, |Numeric Metafunction|, |numeric_cast|, |shift_left|, |bitand_|
126 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
127 Distributed under the Boost Software License, Version 1.0. (See accompanying
128 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)