1 <?xml version=
"1.0" encoding=
"utf-8" ?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
6 <meta name=
"generator" content=
"Docutils 0.7: http://docutils.sourceforge.net/" />
7 <title>The MPL Reference Manual: shift_left
</title>
8 <link rel=
"stylesheet" href=
"../style.css" type=
"text/css" />
10 <body class=
"docframe refmanual">
11 <table class=
"header"><tr class=
"header"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./bitxor.html" class=
"navigation-link">Prev
</a> <a href=
"./shift-right.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./bitxor.html" class=
"navigation-link">Back
</a> <a href=
"./shift-right.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./bitwise-operations.html" class=
"navigation-link">Up
</a> <a href=
"../refmanual.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./refmanual_toc.html" class=
"navigation-link">Full TOC
</a></span></td>
12 <td class=
"header-group page-location"><a href=
"../refmanual.html" class=
"navigation-link">Front Page
</a> /
<a href=
"./metafunctions.html" class=
"navigation-link">Metafunctions
</a> /
<a href=
"./bitwise-operations.html" class=
"navigation-link">Bitwise Operations
</a> /
<a href=
"./shift-left.html" class=
"navigation-link">shift_left
</a></td>
13 </tr></table><div class=
"header-separator"></div>
14 <div class=
"section" id=
"shift-left">
15 <h1><a class=
"toc-backref" href=
"./bitwise-operations.html#id1557">shift_left
</a></h1>
16 <div class=
"section" id=
"id1116">
17 <h3><a class=
"subsection-title" href=
"#synopsis" name=
"synopsis">Synopsis
</a></h3>
18 <pre class=
"literal-block">
23 struct
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a>
25 typedef
<em>unspecified
</em> type;
29 <div class=
"section" id=
"id1117">
30 <h3><a class=
"subsection-title" href=
"#description" name=
"description">Description
</a></h3>
31 <p>Returns the result of bitwise
<em>shift left
</em> (
<tt class=
"literal"><span class=
"pre"><<</span></tt>) operation on
<tt class=
"literal"><span class=
"pre">T
</span></tt>.
</p>
33 <div class=
"section" id=
"id1118">
34 <h3><a class=
"subsection-title" href=
"#header" name=
"header">Header
</a></h3>
35 <pre class=
"literal-block">
36 #include
<<a href=
"../../../../boost/mpl/shift_left.hpp" class=
"header">boost/mpl/shift_left.hpp
</a>>
37 #include
<<a href=
"../../../../boost/mpl/bitwise.hpp" class=
"header">boost/mpl/bitwise.hpp
</a>>
40 <div class=
"section" id=
"id1119">
41 <h3><a class=
"subsection-title" href=
"#model-of" name=
"model-of">Model of
</a></h3>
42 <p><a class=
"reference internal" href=
"./numeric-metafunction.html">Numeric Metafunction
</a></p>
44 <div class=
"section" id=
"id1120">
45 <h3><a class=
"subsection-title" href=
"#parameters" name=
"parameters">Parameters
</a></h3>
46 <table border=
"1" class=
"docutils table">
52 <thead valign=
"bottom">
53 <tr><th class=
"head">Parameter
</th>
54 <th class=
"head">Requirement
</th>
55 <th class=
"head">Description
</th>
59 <tr><td><tt class=
"literal"><span class=
"pre">T
</span></tt></td>
60 <td><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
61 <td>A value to shift.
</td>
63 <tr><td><tt class=
"literal"><span class=
"pre">Shift
</span></tt></td>
64 <td>Unsigned
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
65 <td>A shift distance.
</td>
69 <p>[
<em>Note:
</em> The requirements listed in this specification
70 are the ones imposed by the default implementation. See
<a class=
"reference internal" href=
"./numeric-metafunction.html">Numeric Metafunction
</a> concept
71 for the details on how to provide an implementation for a user-defined numeric type
72 that does not satisfy the
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a> requirements. —
<em>end note
</em>]
</p>
74 <div class=
"section" id=
"id1121">
75 <h3><a class=
"subsection-title" href=
"#expression-semantics" name=
"expression-semantics">Expression semantics
</a></h3>
76 <p>For arbitrary
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a> <tt class=
"literal"><span class=
"pre">c
</span></tt> and unsigned
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a> <tt class=
"literal"><span class=
"pre">shift
</span></tt>:
</p>
77 <pre class=
"literal-block">
78 typedef
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><c,shift
>::type r;
80 <table class=
"docutils field-list" frame=
"void" rules=
"none">
81 <col class=
"field-name" />
82 <col class=
"field-body" />
84 <tr class=
"field"><th class=
"field-name">Return type:
</th><td class=
"field-body"><p class=
"first"><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a>.
</p>
87 <tr class=
"field"><th class=
"field-name">Semantics:
</th><td class=
"field-body"><p class=
"first">Equivalent to
</p>
88 <pre class=
"last literal-block">
89 typedef
<a href=
"./integral-c.html" class=
"identifier">integral_c
</a><
90 c::
<a href=
"./value-type.html" class=
"identifier">value_type
</a>
91 , ( c::value
<< shift::value )
98 <!-- .......................................................................... -->
99 <pre class=
"literal-block">
100 typedef
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><c,shift
> r;
102 <table class=
"docutils field-list" frame=
"void" rules=
"none">
103 <col class=
"field-name" />
104 <col class=
"field-body" />
106 <tr class=
"field"><th class=
"field-name">Return type:
</th><td class=
"field-body"><p class=
"first"><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a>.
</p>
109 <tr class=
"field"><th class=
"field-name">Semantics:
</th><td class=
"field-body"><p class=
"first">Equivalent to
</p>
110 <pre class=
"last literal-block">
111 struct r :
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><c,shift
>::type {};
118 <div class=
"section" id=
"id1122">
119 <h3><a class=
"subsection-title" href=
"#complexity" name=
"complexity">Complexity
</a></h3>
120 <p>Amortized constant time.
</p>
122 <div class=
"section" id=
"id1123">
123 <h3><a class=
"subsection-title" href=
"#example" name=
"example">Example
</a></h3>
124 <pre class=
"literal-block">
125 typedef
<a href=
"./integral-c.html" class=
"identifier">integral_c
</a><unsigned,
0> u0;
126 typedef
<a href=
"./integral-c.html" class=
"identifier">integral_c
</a><unsigned,
1> u1;
127 typedef
<a href=
"./integral-c.html" class=
"identifier">integral_c
</a><unsigned,
2> u2;
128 typedef
<a href=
"./integral-c.html" class=
"identifier">integral_c
</a><unsigned,
8> u8;
130 <a href=
"./assert-relation.html" class=
"identifier">BOOST_MPL_ASSERT_RELATION
</a>( (
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><u0,u0
>::value), ==,
0 );
131 <a href=
"./assert-relation.html" class=
"identifier">BOOST_MPL_ASSERT_RELATION
</a>( (
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><u1,u0
>::value), ==,
1 );
132 <a href=
"./assert-relation.html" class=
"identifier">BOOST_MPL_ASSERT_RELATION
</a>( (
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><u1,u1
>::value), ==,
2 );
133 <a href=
"./assert-relation.html" class=
"identifier">BOOST_MPL_ASSERT_RELATION
</a>( (
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><u2,u1
>::value), ==,
4 );
134 <a href=
"./assert-relation.html" class=
"identifier">BOOST_MPL_ASSERT_RELATION
</a>( (
<a href=
"./shift-left.html" class=
"identifier">shift_left
</a><u8,u1
>::value), ==,
16 );
137 <div class=
"section" id=
"id1124">
138 <h3><a class=
"subsection-title" href=
"#see-also" name=
"see-also">See also
</a></h3>
139 <p><a class=
"reference internal" href=
"./bitwise-operations.html">Bitwise Operations
</a>,
<a class=
"reference internal" href=
"./numeric-metafunction.html">Numeric Metafunction
</a>,
<a class=
"reference internal" href=
"./numeric-cast.html">numeric_cast
</a>,
<a class=
"reference internal" href=
"./shift-right.html">shift_right
</a>,
<a class=
"reference internal" href=
"./bitand.html">bitand_
</a></p>
140 <!-- Metafunctions/Bitwise Operations//shift_right -->
144 <div class=
"footer-separator"></div>
145 <table class=
"footer"><tr class=
"footer"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./bitxor.html" class=
"navigation-link">Prev
</a> <a href=
"./shift-right.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./bitxor.html" class=
"navigation-link">Back
</a> <a href=
"./shift-right.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./bitwise-operations.html" class=
"navigation-link">Up
</a> <a href=
"../refmanual.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./refmanual_toc.html" class=
"navigation-link">Full TOC
</a></span></td>
146 <td><div class=
"copyright-footer"><div class=
"copyright">Copyright ©
2001-
2009 Aleksey Gurtovoy and David Abrahams
</div>
147 Distributed under the Boost Software License, Version
1.0. (See accompanying
148 file LICENSE_1_0.txt or copy at
<a class=
"reference external" href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
</div></td></tr></table></body>