|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48879 - in branches/release: boost boost/utility libs/utility libs/utility/test
From: rivorus_at_[hidden]
Date: 2008-09-19 04:19:03
Author: matt_calabrese
Date: 2008-09-19 04:19:02 EDT (Fri, 19 Sep 2008)
New Revision: 48879
URL: http://svn.boost.org/trac/boost/changeset/48879
Log:
Merged BOOST_BINARY utility macro.
Added:
branches/release/boost/utility/binary.hpp
- copied unchanged from r48637, /trunk/boost/utility/binary.hpp
branches/release/libs/utility/binary_test.cpp
- copied unchanged from r48637, /trunk/libs/utility/binary_test.cpp
Text files modified:
branches/release/boost/utility.hpp | 3 +
branches/release/libs/utility/test/Jamfile.v2 | 1
branches/release/libs/utility/utility.htm | 60 ++++++++++++++++++++++++++++++++++++++-
3 files changed, 61 insertions(+), 3 deletions(-)
Modified: branches/release/boost/utility.hpp
==============================================================================
--- branches/release/boost/utility.hpp (original)
+++ branches/release/boost/utility.hpp 2008-09-19 04:19:02 EDT (Fri, 19 Sep 2008)
@@ -10,7 +10,8 @@
#define BOOST_UTILITY_HPP
#include <boost/utility/addressof.hpp>
-#include <boost/utility/base_from_member.hpp>
+#include <boost/utility/base_from_member.hpp>
+#include <boost/utility/binary.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/checked_delete.hpp>
#include <boost/next_prior.hpp>
Modified: branches/release/libs/utility/test/Jamfile.v2
==============================================================================
--- branches/release/libs/utility/test/Jamfile.v2 (original)
+++ branches/release/libs/utility/test/Jamfile.v2 2008-09-19 04:19:02 EDT (Fri, 19 Sep 2008)
@@ -15,6 +15,7 @@
[ run ../assert_test.cpp ]
[ run ../base_from_member_test.cpp ]
[ run ../binary_search_test.cpp ]
+ [ run ../binary_test.cpp ]
[ run ../call_traits_test.cpp : -u ]
[ compile-fail ../checked_delete_test.cpp ]
[ run ../compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor/<link>static : -u ]
Modified: branches/release/libs/utility/utility.htm
==============================================================================
--- branches/release/libs/utility/utility.htm (original)
+++ branches/release/libs/utility/utility.htm 2008-09-19 04:19:02 EDT (Fri, 19 Sep 2008)
@@ -23,6 +23,8 @@
<li>
Function template addressof()</li>
<li>Class template result_of</li>
+ <li>
+ Macro BOOST_BINARY</li>
<li>Other utilities not part of utility.hpp
</li>
</ul>
<h2>
@@ -181,9 +183,63 @@
<h2>Class templates for the Base-from-Member Idiom</h2>
<p>See separate documentation.</p>
+ <h2><a name="BOOST_BINARY">Macro BOOST_BINARY</a></h2>
+
+ <p>The macro <code>BOOST_BINARY</code> is used for the
+ representation of binary literals. It takes as an argument
+ a binary number arranged as an arbitrary amount of 1s and 0s in
+ groupings of length 1 to 8, with groups separated
+ by spaces. The type of the literal yielded is determined by
+ the same rules as those of hex and octal
+ literals (<i>2.13.1p1</i>). By implementation, this macro
+ expands directly to an octal literal during preprocessing, so
+ there is no overhead at runtime and the result is useable in
+ any place that an octal literal would be.</p>
+
+ <p>In order to directly support binary literals with suffixes,
+ additional macros of the form BOOST_BINARY_XXX are also
+ provided, where XXX is a standard integer suffix in all capital
+ letters. In addition, LL and ULL suffixes may be used for representing
+ long long and unsigned long long types in compilers which provide
+ them as an extension.</p>
+
+
+ <p>The BOOST_BINARY family of macros resides in the header
+ <a
+ href="../../boost/utility/binary.hpp"><boost/utility/binary.hpp></a>
+ which is automatically included by
+ <a
+ href="../../boost/utility.hpp"><boost/utility.hpp></a>.
+
+ <p>Contributed by Matt Calabrese.</p><p>
+ </p><h3>Example</h3>
+ <blockquote>
+ <pre>
+void foo( int );
+
+void foo( unsigned long );
+
+void bar()
+{
+ int value1 = BOOST_BINARY( 100 111000 01 1 110 );
+
+ unsigned long value2 = BOOST_BINARY_UL( 100 001 ); // unsigned long
+
+ long long value3 = BOOST_BINARY_LL( 11 000 ); // long long if supported
+
+ assert( BOOST_BINARY( 10010 )
+ & BOOST_BINARY( 11000 )
+ == BOOST_BINARY( 10000 )
+ );
+
+ foo( BOOST_BINARY( 1010 ) ); // calls the first foo
+
+ foo( BOOST_BINARY_LU( 1010 ) ); // calls the second foo
+}
+</pre></blockquote>
<hr>
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan
--->07 November, 2007<!--webbot bot="Timestamp" endspan i-checksum="39369"
+-->04 September, 2008<!--webbot bot="Timestamp" endspan i-checksum="39369"
-->
</p>
<p>© Copyright Beman Dawes 1999-2003.</p>
@@ -191,4 +247,4 @@
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</body>
-</html>
\ No newline at end of file
+</html>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk