mirror of
https://github.com/boostorg/utility.git
synced 2025-06-25 20:11:33 +02:00
Compare commits
169 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
46d5bb0538 | |||
5825b6c329 | |||
54c78121c2 | |||
2891cb52d6 | |||
0db9276e8c | |||
d6cb9a9176 | |||
ef0f82f62b | |||
9a16aaa2b9 | |||
e763315b55 | |||
fe653d0a9a | |||
26b39384e3 | |||
9525d062b3 | |||
6d196c4244 | |||
e83682c091 | |||
1d146d010a | |||
5684a2f2b3 | |||
95d2c38379 | |||
7d23c75eef | |||
3279399fe3 | |||
87875cadda | |||
c58748cfd9 | |||
58bb88d4bd | |||
11d50ecb9f | |||
636283d7c2 | |||
1df0bf80bc | |||
71e78a0081 | |||
f7e4b0e399 | |||
fb1d2effef | |||
94b91e8c92 | |||
a4b8043e68 | |||
b4a08fc80e | |||
9da96d9737 | |||
a991936c96 | |||
6239e685a2 | |||
e601fcb9c9 | |||
f29a5db08e | |||
22743ee125 | |||
e3c982287a | |||
82e1111bb8 | |||
9339b32178 | |||
3770221507 | |||
e6cb3a77ee | |||
bbccfbbab4 | |||
74a6a693d3 | |||
bf713ad47a | |||
76b17c497b | |||
3de5974419 | |||
7eb1536590 | |||
9339431e03 | |||
f2349baf7d | |||
8745ca628a | |||
ba61e9d796 | |||
afe74fffbc | |||
09a0137016 | |||
a1d3ec6c53 | |||
5be3004e6c | |||
d387905150 | |||
b514e40733 | |||
b02677375f | |||
61a6015b5a | |||
682032a340 | |||
67afd7e315 | |||
75cf20cace | |||
91385ac627 | |||
61e9b93f7c | |||
d97b303777 | |||
3900e8ece4 | |||
e27fc4a853 | |||
f7aa9a8935 | |||
0af1959b30 | |||
5f0cf4f5de | |||
0282c8a141 | |||
6725719bd9 | |||
97e11b024e | |||
118e473a3d | |||
d4b6193f94 | |||
d420c98a53 | |||
d153ab4daa | |||
561f83b991 | |||
57124703f9 | |||
53f6d10652 | |||
ebe853ff2f | |||
487a5c1ea5 | |||
c4338b1ce8 | |||
ddd8a58ae0 | |||
28061ba3a8 | |||
5d53e3f837 | |||
e86ce1cb1f | |||
f15c96ffb0 | |||
a487f72329 | |||
9f08ed6de0 | |||
2077d0dace | |||
7f2348269b | |||
6b6e1c3252 | |||
55f303baec | |||
d264005c11 | |||
2cde009bb1 | |||
7bfb7c8a61 | |||
5c42397244 | |||
782c132d99 | |||
36899afa3f | |||
7e3e326faf | |||
7019e18149 | |||
49faf23433 | |||
62836f2928 | |||
1ecf3ceb74 | |||
2aa48414c9 | |||
d215f2176c | |||
c286d62223 | |||
3fd0ea6e75 | |||
b050431638 | |||
b311fcefb2 | |||
899c92420c | |||
64a0e0cb20 | |||
ece6992540 | |||
6098304ea8 | |||
28fff2d821 | |||
0ce3885d59 | |||
1823481d96 | |||
cce5d77d2b | |||
3c5c2bc107 | |||
177ee78bbb | |||
f1ec0c4d04 | |||
4a564744fe | |||
67f3ca090a | |||
8efae71f4a | |||
ad0bcf4a00 | |||
f1c86c35c4 | |||
a5b85eda07 | |||
bafe37fdab | |||
be50b95508 | |||
96d573d6ca | |||
2412b864d6 | |||
94865eabe6 | |||
50268d1b29 | |||
ad9108c1dc | |||
691e4b6c34 | |||
28596e678d | |||
1beca24dd8 | |||
721764937f | |||
a511007d0f | |||
8ce58b1675 | |||
9ed68b8321 | |||
79bbf71d0d | |||
ac93de7c1b | |||
d731b8e1c5 | |||
ac1567b3fc | |||
c1fd670480 | |||
01274cf6ac | |||
8080673977 | |||
a470b591fb | |||
e1a63495b6 | |||
7300ac83f1 | |||
882d38c2c7 | |||
33041ad664 | |||
6a2aa822f8 | |||
09ab16bfc1 | |||
ec46e40809 | |||
b3a971e7e9 | |||
7ddb559887 | |||
ea8c99b1d5 | |||
56b0846099 | |||
42e0001370 | |||
cd8f85afee | |||
bddd52c4b9 | |||
8f03aeac4e | |||
3bb2568fad | |||
01e91a3799 | |||
55f3c351a3 |
@ -85,7 +85,7 @@
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
|
@ -509,7 +509,7 @@ Returns the largest size that this Collection can ever have. <A href="#8">[8]</A
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
|
@ -160,7 +160,7 @@ t.~T()
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
|
@ -185,7 +185,7 @@
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
|
@ -70,7 +70,7 @@
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
|
@ -145,14 +145,20 @@ objects are is implemented in <a href="../../boost/utility/compare_pointees.hpp"
|
||||
so direct usage of relational operators with the implied aliasing of shallow semantics
|
||||
-as with pointers- should not be used with generic code written for this concept.</p>
|
||||
|
||||
<h3>Acknowledgements</h3>
|
||||
<p>Based on the original concept developed by Augustus Saunders.
|
||||
|
||||
<br>
|
||||
</p>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2003</TD><TD>
|
||||
<A HREF="mailto:fernando_cacciola@hotmail.com">Fernando Cacciola</A>,
|
||||
based on the original concept developed by Augustus Saunders.
|
||||
<A HREF="mailto:fernando_cacciola@hotmail.com">Fernando Cacciola</A>
|
||||
</TD></TR></TABLE>
|
||||
|
||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
76
addressof_fn_test.cpp
Normal file
76
addressof_fn_test.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
// addressof_fn_test.cpp: addressof( f )
|
||||
//
|
||||
// Copyright (c) 2008, 2009 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
|
||||
void f0()
|
||||
{
|
||||
}
|
||||
|
||||
void f1(int)
|
||||
{
|
||||
}
|
||||
|
||||
void f2(int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f3(int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f4(int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f5(int, int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f6(int, int, int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f7(int, int, int, int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f8(int, int, int, int, int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void f9(int, int, int, int, int, int, int, int, int)
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST( boost::addressof( f0 ) == &f0 );
|
||||
BOOST_TEST( boost::addressof( f1 ) == &f1 );
|
||||
BOOST_TEST( boost::addressof( f2 ) == &f2 );
|
||||
BOOST_TEST( boost::addressof( f3 ) == &f3 );
|
||||
BOOST_TEST( boost::addressof( f4 ) == &f4 );
|
||||
BOOST_TEST( boost::addressof( f5 ) == &f5 );
|
||||
BOOST_TEST( boost::addressof( f6 ) == &f6 );
|
||||
BOOST_TEST( boost::addressof( f7 ) == &f7 );
|
||||
BOOST_TEST( boost::addressof( f8 ) == &f8 );
|
||||
BOOST_TEST( boost::addressof( f9 ) == &f9 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
95
addressof_test2.cpp
Normal file
95
addressof_test2.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
||||
// Douglas Gregor (gregod@cs.rpi.edu)
|
||||
//
|
||||
// Copyright 2009 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
template<class T> void scalar_test( T * = 0 )
|
||||
{
|
||||
T* px = new T();
|
||||
|
||||
T& x = *px;
|
||||
BOOST_TEST( boost::addressof(x) == px );
|
||||
|
||||
const T& cx = *px;
|
||||
const T* pcx = boost::addressof(cx);
|
||||
BOOST_TEST( pcx == px );
|
||||
|
||||
volatile T& vx = *px;
|
||||
volatile T* pvx = boost::addressof(vx);
|
||||
BOOST_TEST( pvx == px );
|
||||
|
||||
const volatile T& cvx = *px;
|
||||
const volatile T* pcvx = boost::addressof(cvx);
|
||||
BOOST_TEST( pcvx == px );
|
||||
|
||||
delete px;
|
||||
}
|
||||
|
||||
template<class T> void array_test( T * = 0 )
|
||||
{
|
||||
T nrg[3] = {1,2,3};
|
||||
T (*pnrg)[3] = &nrg;
|
||||
BOOST_TEST( boost::addressof(nrg) == pnrg );
|
||||
|
||||
T const cnrg[3] = {1,2,3};
|
||||
T const (*pcnrg)[3] = &cnrg;
|
||||
BOOST_TEST( boost::addressof(cnrg) == pcnrg );
|
||||
}
|
||||
|
||||
class convertible {
|
||||
public:
|
||||
|
||||
convertible( int = 0 )
|
||||
{
|
||||
}
|
||||
|
||||
template<class U> operator U () const
|
||||
{
|
||||
return U();
|
||||
}
|
||||
};
|
||||
|
||||
class convertible2 {
|
||||
public:
|
||||
|
||||
convertible2( int = 0 )
|
||||
{
|
||||
}
|
||||
|
||||
operator convertible2* () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
scalar_test<convertible>();
|
||||
scalar_test<convertible2>();
|
||||
|
||||
array_test<convertible>();
|
||||
array_test<convertible2>();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
84
assert.html
84
assert.html
@ -17,39 +17,99 @@
|
||||
<td colspan="2" height="64"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<a href="#BOOST_ASSERT">BOOST_ASSERT</a><br>
|
||||
<a href="#BOOST_ASSERT_MSG">BOOST_ASSERT_MSG</a><br>
|
||||
<a href="#BOOST_VERIFY">BOOST_VERIFY</a></p>
|
||||
|
||||
<h2><a name="BOOST_ASSERT">BOOST_ASSERT</a></h2>
|
||||
<p>
|
||||
The header <STRONG><boost/assert.hpp></STRONG> defines the macro <b>BOOST_ASSERT</b>,
|
||||
which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG><cassert></STRONG>.
|
||||
The macro is intended to be used in Boost libraries.
|
||||
The macro is intended to be used in both Boost libraries and user
|
||||
code.
|
||||
</p>
|
||||
<P>By default, <tt>BOOST_ASSERT(expr)</tt> is equivalent to <tt>assert(expr)</tt>.</P>
|
||||
<P>When the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
||||
<P>If the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
||||
is included, <tt>BOOST_ASSERT(expr)</tt> is defined as <tt>((void)0)</tt>. This
|
||||
allows users to selectively disable <STRONG>BOOST_ASSERT</STRONG> without
|
||||
affecting the definition of the standard <STRONG>assert</STRONG>.</P>
|
||||
<P>When the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
||||
<P>If the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
||||
is included, <tt>BOOST_ASSERT(expr)</tt> evaluates <b>expr</b> and, if the
|
||||
result is false, evaluates the expression</P>
|
||||
<blockquote>
|
||||
<P><tt>::boost::assertion_failed(#expr, <a href="current_function.html">BOOST_CURRENT_FUNCTION</a>,
|
||||
__FILE__, __LINE__)</tt></P>
|
||||
</blockquote>
|
||||
<P><STRONG>assertion_failed</STRONG> is declared in <STRONG><boost/assert.hpp></STRONG>
|
||||
as</P>
|
||||
<pre>
|
||||
namespace boost
|
||||
<blockquote>
|
||||
<pre>namespace boost
|
||||
{
|
||||
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line);
|
||||
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line);
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>but it is never defined. The user is expected to supply an appropriate
|
||||
definition.</p>
|
||||
<P>As is the case with <STRONG><cassert></STRONG>, <STRONG><boost/assert.hpp></STRONG>
|
||||
can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT</STRONG>
|
||||
will be redefined each time as specified above.</P>
|
||||
|
||||
<h2><a name="BOOST_ASSERT_MSG">BOOST_ASSERT_MSG</a></h2>
|
||||
<p>
|
||||
The header <STRONG><boost/assert.hpp></STRONG> defines the macro <b>BOOST_ASSERT_MSG</b>,
|
||||
which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG><cassert></STRONG>,
|
||||
but with an additional macro parameter supplying an error message. The macro is intended to be used in both Boost libraries
|
||||
and user code.
|
||||
</p>
|
||||
<P> <tt>BOOST_ASSERT_MSG(expr, msg)</tt> is equivalent to <code>
|
||||
((void)0)</code> if <b>BOOST_DISABLE_ASSERTS</b> or <b>NDEBUG</b> are
|
||||
defined or <code>expr</code> evaluates to <code>true</code>. If those
|
||||
macros and <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> are not
|
||||
defined, and <code>expr</code> evaluates to <code>false</code>, an error
|
||||
message that includes <tt>#expr</tt>, <tt>msg</tt>, <tt> <a href="current_function.html">BOOST_CURRENT_FUNCTION</a></tt>, <tt>
|
||||
__FILE__</tt>, and <tt>__LINE__</tt> is sent to output stream <b>
|
||||
BOOST_ASSERT_MSG_OSTREAM</b>
|
||||
and <code>std::abort()</code> is called.</P>
|
||||
<P> <b>BOOST_ASSERT_MSG_OSTREAM</b> defines the output stream. It defaults to <code>std::cerr</code>.
|
||||
Integrated development environments (IDE's) like Microsoft Visual Studio
|
||||
may produce easier to understand output if messages go to a different
|
||||
stream, such as <code>std::cout</code>. Users may define <b>BOOST_ASSERT_MSG_OSTREAM</b> before including <STRONG><boost/assert.hpp></STRONG>
|
||||
to specify a different output stream. </P>
|
||||
<P>If the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
||||
is included, instead of sending a error message to an output
|
||||
stream, this expression is evaluated</P>
|
||||
<blockquote>
|
||||
<P><tt>::boost::assertion_failed_msg(#expr, msg, <a href="current_function.html">BOOST_CURRENT_FUNCTION</a>,
|
||||
__FILE__, __LINE__)</tt></P>
|
||||
</blockquote>
|
||||
<P><STRONG>assertion_failed_msg</STRONG> is declared in <STRONG><boost/assert.hpp></STRONG>
|
||||
as</P>
|
||||
<blockquote>
|
||||
<pre>namespace boost
|
||||
{
|
||||
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line);
|
||||
}
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>but it is never defined. The user is expected to supply an appropriate
|
||||
definition.</p>
|
||||
<P>As is the case with <STRONG><cassert></STRONG>, <STRONG><boost/assert.hpp></STRONG>
|
||||
can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT_MSG</STRONG>
|
||||
will be redefined each time as specified above.</P>
|
||||
|
||||
<h2><a name="BOOST_VERIFY">BOOST_VERIFY</a></h2>
|
||||
<p><STRONG><boost/assert.hpp></STRONG> also defines the macro <STRONG>BOOST_VERIFY</STRONG>.
|
||||
It has exactly the same behavior as <STRONG>BOOST_ASSERT</STRONG>, except that
|
||||
the expression that is passed to <STRONG>BOOST_VERIFY</STRONG> is always
|
||||
evaluated. This is useful when the asserted expression has desirable side
|
||||
effects; it can also help suppress warnings about unused variables when the
|
||||
only use of the variable is inside an assertion.</p>
|
||||
<p><br>
|
||||
<small>Copyright <20> 2002 by Peter Dimov. Distributed under the Boost Software License, Version
|
||||
1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or
|
||||
copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p>
|
||||
<small>Copyright <20> 2002, 2007 by Peter Dimov. Copyright <20> 2011
|
||||
by Beman Dawes. Distributed under the Boost Software
|
||||
License, Version 1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
|
||||
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -2,6 +2,7 @@
|
||||
// assert_test.cpp - a test for boost/assert.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (2) Beman Dawes 2011
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -20,6 +21,11 @@ void test_default()
|
||||
BOOST_ASSERT(x);
|
||||
BOOST_ASSERT(x == 1);
|
||||
BOOST_ASSERT(&x);
|
||||
|
||||
BOOST_ASSERT_MSG(1, "msg");
|
||||
BOOST_ASSERT_MSG(x, "msg");
|
||||
BOOST_ASSERT_MSG(x == 1, "msg");
|
||||
BOOST_ASSERT_MSG(&x, "msg");
|
||||
}
|
||||
|
||||
#define BOOST_DISABLE_ASSERTS
|
||||
@ -34,13 +40,23 @@ void test_disabled()
|
||||
BOOST_ASSERT(x == 1);
|
||||
BOOST_ASSERT(&x);
|
||||
|
||||
BOOST_ASSERT_MSG(1, "msg");
|
||||
BOOST_ASSERT_MSG(x, "msg");
|
||||
BOOST_ASSERT_MSG(x == 1, "msg");
|
||||
BOOST_ASSERT_MSG(&x, "msg");
|
||||
|
||||
BOOST_ASSERT(0);
|
||||
BOOST_ASSERT(!x);
|
||||
BOOST_ASSERT(x == 0);
|
||||
|
||||
BOOST_ASSERT_MSG(0, "msg");
|
||||
BOOST_ASSERT_MSG(!x, "msg");
|
||||
BOOST_ASSERT_MSG(x == 0, "msg");
|
||||
|
||||
void * p = 0;
|
||||
|
||||
BOOST_ASSERT(p);
|
||||
BOOST_ASSERT_MSG(p, "msg");
|
||||
|
||||
// supress warnings
|
||||
p = &x;
|
||||
@ -55,6 +71,7 @@ void test_disabled()
|
||||
#include <cstdio>
|
||||
|
||||
int handler_invoked = 0;
|
||||
int msg_handler_invoked = 0;
|
||||
|
||||
void boost::assertion_failed(char const * expr, char const * function, char const * file, long line)
|
||||
{
|
||||
@ -66,11 +83,24 @@ void boost::assertion_failed(char const * expr, char const * function, char cons
|
||||
++handler_invoked;
|
||||
}
|
||||
|
||||
void boost::assertion_failed_msg(char const * expr, char const * msg, char const * function,
|
||||
char const * file, long line)
|
||||
{
|
||||
#if !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using std::printf;
|
||||
#endif
|
||||
|
||||
printf("Expression: %s Message: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n",
|
||||
expr, msg, function, file, line);
|
||||
++msg_handler_invoked;
|
||||
}
|
||||
|
||||
struct X
|
||||
{
|
||||
static void f()
|
||||
{
|
||||
BOOST_ASSERT(0);
|
||||
BOOST_ASSERT_MSG(0, "msg f()");
|
||||
}
|
||||
};
|
||||
|
||||
@ -83,21 +113,35 @@ void test_handler()
|
||||
BOOST_ASSERT(x == 1);
|
||||
BOOST_ASSERT(&x);
|
||||
|
||||
BOOST_ASSERT_MSG(1, "msg2");
|
||||
BOOST_ASSERT_MSG(x, "msg3");
|
||||
BOOST_ASSERT_MSG(x == 1, "msg4");
|
||||
BOOST_ASSERT_MSG(&x, "msg5");
|
||||
|
||||
BOOST_ASSERT(0);
|
||||
BOOST_ASSERT(!x);
|
||||
BOOST_ASSERT(x == 0);
|
||||
|
||||
BOOST_ASSERT_MSG(0,"msg 0");
|
||||
BOOST_ASSERT_MSG(!x, "msg !x");
|
||||
BOOST_ASSERT_MSG(x == 0, "msg x == 0");
|
||||
|
||||
void * p = 0;
|
||||
|
||||
BOOST_ASSERT(p);
|
||||
BOOST_ASSERT_MSG(p, "msg p");
|
||||
|
||||
X::f();
|
||||
|
||||
BOOST_ASSERT(handler_invoked == 5);
|
||||
BOOST_TEST(handler_invoked == 5);
|
||||
|
||||
BOOST_ASSERT_MSG(msg_handler_invoked == 5, "msg_handler_invoked count is wrong");
|
||||
BOOST_TEST(msg_handler_invoked == 5);
|
||||
}
|
||||
|
||||
#undef BOOST_ENABLE_ASSERT_HANDLER
|
||||
#undef BOOST_ENABLE_ASSERT_MSG_HANDLER
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -129,6 +129,8 @@ particular member type does not need to concern itself with the integer.</p>
|
||||
<h2><a name="synopsis">Synopsis</a></h2>
|
||||
|
||||
<blockquote><pre>
|
||||
#include <type_traits> <i>// exposition only</i>
|
||||
|
||||
#ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY
|
||||
#define BOOST_BASE_FROM_MEMBER_MAX_ARITY 10
|
||||
#endif
|
||||
@ -139,6 +141,11 @@ class boost::base_from_member
|
||||
protected:
|
||||
MemberType member;
|
||||
|
||||
#if <i>C++2011 is in use</i>
|
||||
template< typename ...T >
|
||||
explicit constexpr base_from_member( T&& ...x )
|
||||
noexcept( std::is_nothrow_constructible<MemberType, T...>::value );
|
||||
#else
|
||||
base_from_member();
|
||||
|
||||
template< typename T1 >
|
||||
@ -154,6 +161,7 @@ protected:
|
||||
typename T10 >
|
||||
base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7,
|
||||
T8 x8, T9 x9, T10 x10 );
|
||||
#endif
|
||||
};
|
||||
</pre></blockquote>
|
||||
|
||||
@ -166,13 +174,29 @@ value of zero if it is omitted. The class template has a protected
|
||||
data member called <var>member</var> that the derived class can use
|
||||
for later base classes (or itself).</p>
|
||||
|
||||
<p>There is a default constructor and several constructor member
|
||||
templates. These constructor templates can take as many arguments
|
||||
(currently up to ten) as possible and pass them to a constructor of
|
||||
the data member. Since C++ does not allow any way to explicitly state
|
||||
<p>If the appropriate features of C++2011 are present, there will be a single
|
||||
constructor template. It implements "perfect forwarding" to the best
|
||||
constructor call of <code>member</code> (if any). The constructor template is
|
||||
marked both <code>constexpr</code> and <code>explicit</code>. The former will
|
||||
be ignored if the corresponding inner constructor call (of <code>member</code>)
|
||||
does not have the marker. The latter binds the other way; always taking
|
||||
effect, even when the inner constructor call does not have the marker. The
|
||||
constructor template propagates the <code>noexcept</code> status of the inner
|
||||
constructor call. (The constructor template has a trailing parameter with a
|
||||
default value that disables the template when its signature is too close to the
|
||||
signatures of the automatically-defined non-template copy- and/or
|
||||
move-constructors of <code>base_from_member</code>.)</p>
|
||||
|
||||
<p>On earlier-standard compilers, there is a default constructor and several
|
||||
constructor member templates. These constructor templates can take as many
|
||||
arguments (currently up to ten) as possible and pass them to a constructor of
|
||||
the data member.</p>
|
||||
|
||||
<p>Since C++ does not allow any way to explicitly state
|
||||
the template parameters of a templated constructor, make sure that
|
||||
the arguments are already close as possible to the actual type used in
|
||||
the data member's desired constructor.</p>
|
||||
the data member's desired constructor. Explicit conversions may be
|
||||
necessary.</p>
|
||||
|
||||
<p>The <var>BOOST_BASE_FROM_MEMBER_MAX_ARITY</var> macro constant specifies
|
||||
the maximum argument length for the constructor templates. The constant
|
||||
@ -180,7 +204,7 @@ may be overridden if more (or less) argument configurations are needed. The
|
||||
constant may be read for code that is expandable like the class template and
|
||||
needs to maintain the same maximum size. (Example code would be a class that
|
||||
uses this class template as a base class for a member with a flexible set of
|
||||
constructors.)</p>
|
||||
constructors.) This constant is ignored when C++2011 features are present.</p>
|
||||
|
||||
<h2><a name="usage">Usage</a></h2>
|
||||
|
||||
@ -323,18 +347,21 @@ constructor argument for <code>pbase0_type</code> is converted from
|
||||
argument for <code>pbase2_type</code> is converted from <code>int</code>
|
||||
to <code>double</code>. The second constructor argument for
|
||||
<code>pbase3_type</code> is a special case of necessary conversion; all
|
||||
forms of the null-pointer literal in C++ also look like compile-time
|
||||
integral expressions, so C++ always interprets such code as an integer
|
||||
when it has overloads that can take either an integer or a pointer. The
|
||||
last conversion is necessary for the compiler to call a constructor form
|
||||
with the exact pointer type used in <code>switcher</code>'s constructor.</p>
|
||||
forms of the null-pointer literal in C++ (except <code>nullptr</code> from
|
||||
C++2011) also look like compile-time integral expressions, so C++ always
|
||||
interprets such code as an integer when it has overloads that can take either
|
||||
an integer or a pointer. The last conversion is necessary for the compiler to
|
||||
call a constructor form with the exact pointer type used in
|
||||
<code>switcher</code>'s constructor. (If C++2011's <code>nullptr</code> is
|
||||
used, it still needs a conversion if multiple pointer types can be accepted in
|
||||
a constructor call but <code>std::nullptr_t</code> cannot.)</p>
|
||||
|
||||
<h2><a name="credits">Credits</a></h2>
|
||||
|
||||
<h3><a name="contributors">Contributors</a></h3>
|
||||
|
||||
<dl>
|
||||
<dt><a href="../../people/ed_brey.htm">Ed Brey</a>
|
||||
<dt><a href="http://www.boost.org/people/ed_brey.htm">Ed Brey</a>
|
||||
<dd>Suggested some interface changes.
|
||||
|
||||
<dt><a href="http://www.moocat.org">R. Samuel Klatchko</a> (<a
|
||||
@ -343,7 +370,7 @@ with the exact pointer type used in <code>switcher</code>'s constructor.</p>
|
||||
<dd>Invented the idiom of how to use a class member for initializing
|
||||
a base class.
|
||||
|
||||
<dt><a href="../../people/dietmar_kuehl.htm">Dietmar Kuehl</a>
|
||||
<dt><a href="http://www.boost.org/people/dietmar_kuehl.htm">Dietmar Kuehl</a>
|
||||
<dd>Popularized the base-from-member idiom in his
|
||||
<a href="http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/">IOStream
|
||||
example classes</a>.
|
||||
@ -353,16 +380,16 @@ with the exact pointer type used in <code>switcher</code>'s constructor.</p>
|
||||
can be controlled and automated with macros. The implementation uses
|
||||
the <a href="../preprocessor/index.html">Preprocessor library</a>.
|
||||
|
||||
<dt><a href="../../people/daryle_walker.html">Daryle Walker</a>
|
||||
<dt><a href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>
|
||||
<dd>Started the library. Contributed the test file <cite><a
|
||||
href="base_from_member_test.cpp">base_from_member_test.cpp</a></cite>.
|
||||
</dl>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Revised: 28 August 2004</p>
|
||||
<p>Revised: 16 February 2012</p>
|
||||
|
||||
<p>Copyright 2001, 2003, 2004 Daryle Walker. Use, modification, and distribution
|
||||
<p>Copyright 2001, 2003, 2004, 2012 Daryle Walker. Use, modification, and distribution
|
||||
are subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
|
||||
href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)</p>
|
||||
|
@ -281,7 +281,7 @@ object_id_compare::operator ()
|
||||
}
|
||||
else
|
||||
{
|
||||
return a.second->before( *b.second );
|
||||
return a.second->before( *b.second ) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
647
binary_test.cpp
Normal file
647
binary_test.cpp
Normal file
@ -0,0 +1,647 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006, 2007 Matthew Calabrese
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/utility/binary.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4996) // warning C4996: 'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
|
||||
#endif
|
||||
|
||||
/*
|
||||
Note: This file tests every single valid bit-grouping on its own, and some
|
||||
random combinations of bit-groupings.
|
||||
*/
|
||||
|
||||
std::size_t const num_random_test_values = 32;
|
||||
|
||||
// Note: These hex values should all correspond with the binary array below
|
||||
unsigned int const random_unsigned_ints_hex[num_random_test_values]
|
||||
= { 0x0103u, 0x77ebu, 0x5f36u, 0x1f18u, 0xc530u, 0xa73au, 0xd6f8u, 0x0919u
|
||||
, 0xfbb0u, 0x3e7cu, 0xd0e9u, 0x22c8u, 0x724eu, 0x14fau, 0xd98eu, 0x40b5
|
||||
, 0xeba0u, 0xfe50u, 0x688au, 0x1b05u, 0x5f9cu, 0xe4fcu, 0xa7b8u, 0xd3acu
|
||||
, 0x1dddu, 0xbf04u, 0x8352u, 0xe89cu, 0x7506u, 0xe767u, 0xf489u, 0xe167
|
||||
};
|
||||
|
||||
unsigned int const random_unsigned_ints_binary[num_random_test_values]
|
||||
= { BOOST_BINARY( 0 00010000 0011 ), BOOST_BINARY( 0 11101 1111 101011 )
|
||||
, BOOST_BINARY( 010111 1100110 1 1 0 ), BOOST_BINARY( 000 1 11110 00 11000 )
|
||||
, BOOST_BINARY( 110 001010 0110 000 ), BOOST_BINARY( 1010 01110011 1010 )
|
||||
, BOOST_BINARY( 11 010 1 101111 1000 ), BOOST_BINARY( 0000 100100 0110 01 )
|
||||
, BOOST_BINARY( 1111 101110 11 0000 ), BOOST_BINARY( 00111110 01111100 )
|
||||
, BOOST_BINARY( 11 010 000111 01001 ), BOOST_BINARY( 00100 010110 01000 )
|
||||
, BOOST_BINARY( 01 11001001 001110 ), BOOST_BINARY( 0010 1001111 1010 )
|
||||
, BOOST_BINARY( 1101 1 00110 0 01110 ), BOOST_BINARY( 100 000 01011010 1 )
|
||||
, BOOST_BINARY( 11 1010 1110 1000 00 ), BOOST_BINARY( 11111 110010 10000 )
|
||||
, BOOST_BINARY( 01101 00010 001010 ), BOOST_BINARY( 000 11011 000001 01 )
|
||||
, BOOST_BINARY( 01 01111 1100111 00 ), BOOST_BINARY( 1 110010 0111111 00 )
|
||||
, BOOST_BINARY( 101 0011 11 01110 00 ), BOOST_BINARY( 110100 1 110101 100 )
|
||||
, BOOST_BINARY( 00 1110111 011 101 ), BOOST_BINARY( 1011 1111 00000 100 )
|
||||
, BOOST_BINARY( 1000 00110 101 0010 ), BOOST_BINARY( 1110 10001 001110 0 )
|
||||
, BOOST_BINARY( 011 1010100 000 110 ), BOOST_BINARY( 1110 0111 01100 111 )
|
||||
, BOOST_BINARY( 11110 10010 001001 ), BOOST_BINARY( 11 1000010 1100 111 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_1_bit[2] =
|
||||
{ BOOST_BINARY( 0 )
|
||||
, BOOST_BINARY( 1 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_2_bits[4] =
|
||||
{ BOOST_BINARY( 00 )
|
||||
, BOOST_BINARY( 01 )
|
||||
, BOOST_BINARY( 10 )
|
||||
, BOOST_BINARY( 11 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_3_bits[8] =
|
||||
{ BOOST_BINARY( 000 )
|
||||
, BOOST_BINARY( 001 )
|
||||
, BOOST_BINARY( 010 )
|
||||
, BOOST_BINARY( 011 )
|
||||
, BOOST_BINARY( 100 )
|
||||
, BOOST_BINARY( 101 )
|
||||
, BOOST_BINARY( 110 )
|
||||
, BOOST_BINARY( 111 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_4_bits[16] =
|
||||
{ BOOST_BINARY( 0000 )
|
||||
, BOOST_BINARY( 0001 )
|
||||
, BOOST_BINARY( 0010 )
|
||||
, BOOST_BINARY( 0011 )
|
||||
, BOOST_BINARY( 0100 )
|
||||
, BOOST_BINARY( 0101 )
|
||||
, BOOST_BINARY( 0110 )
|
||||
, BOOST_BINARY( 0111 )
|
||||
, BOOST_BINARY( 1000 )
|
||||
, BOOST_BINARY( 1001 )
|
||||
, BOOST_BINARY( 1010 )
|
||||
, BOOST_BINARY( 1011 )
|
||||
, BOOST_BINARY( 1100 )
|
||||
, BOOST_BINARY( 1101 )
|
||||
, BOOST_BINARY( 1110 )
|
||||
, BOOST_BINARY( 1111 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_5_bits[32] =
|
||||
{ BOOST_BINARY( 00000 )
|
||||
, BOOST_BINARY( 00001 )
|
||||
, BOOST_BINARY( 00010 )
|
||||
, BOOST_BINARY( 00011 )
|
||||
, BOOST_BINARY( 00100 )
|
||||
, BOOST_BINARY( 00101 )
|
||||
, BOOST_BINARY( 00110 )
|
||||
, BOOST_BINARY( 00111 )
|
||||
, BOOST_BINARY( 01000 )
|
||||
, BOOST_BINARY( 01001 )
|
||||
, BOOST_BINARY( 01010 )
|
||||
, BOOST_BINARY( 01011 )
|
||||
, BOOST_BINARY( 01100 )
|
||||
, BOOST_BINARY( 01101 )
|
||||
, BOOST_BINARY( 01110 )
|
||||
, BOOST_BINARY( 01111 )
|
||||
, BOOST_BINARY( 10000 )
|
||||
, BOOST_BINARY( 10001 )
|
||||
, BOOST_BINARY( 10010 )
|
||||
, BOOST_BINARY( 10011 )
|
||||
, BOOST_BINARY( 10100 )
|
||||
, BOOST_BINARY( 10101 )
|
||||
, BOOST_BINARY( 10110 )
|
||||
, BOOST_BINARY( 10111 )
|
||||
, BOOST_BINARY( 11000 )
|
||||
, BOOST_BINARY( 11001 )
|
||||
, BOOST_BINARY( 11010 )
|
||||
, BOOST_BINARY( 11011 )
|
||||
, BOOST_BINARY( 11100 )
|
||||
, BOOST_BINARY( 11101 )
|
||||
, BOOST_BINARY( 11110 )
|
||||
, BOOST_BINARY( 11111 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_6_bits[64] =
|
||||
{ BOOST_BINARY( 000000 )
|
||||
, BOOST_BINARY( 000001 )
|
||||
, BOOST_BINARY( 000010 )
|
||||
, BOOST_BINARY( 000011 )
|
||||
, BOOST_BINARY( 000100 )
|
||||
, BOOST_BINARY( 000101 )
|
||||
, BOOST_BINARY( 000110 )
|
||||
, BOOST_BINARY( 000111 )
|
||||
, BOOST_BINARY( 001000 )
|
||||
, BOOST_BINARY( 001001 )
|
||||
, BOOST_BINARY( 001010 )
|
||||
, BOOST_BINARY( 001011 )
|
||||
, BOOST_BINARY( 001100 )
|
||||
, BOOST_BINARY( 001101 )
|
||||
, BOOST_BINARY( 001110 )
|
||||
, BOOST_BINARY( 001111 )
|
||||
, BOOST_BINARY( 010000 )
|
||||
, BOOST_BINARY( 010001 )
|
||||
, BOOST_BINARY( 010010 )
|
||||
, BOOST_BINARY( 010011 )
|
||||
, BOOST_BINARY( 010100 )
|
||||
, BOOST_BINARY( 010101 )
|
||||
, BOOST_BINARY( 010110 )
|
||||
, BOOST_BINARY( 010111 )
|
||||
, BOOST_BINARY( 011000 )
|
||||
, BOOST_BINARY( 011001 )
|
||||
, BOOST_BINARY( 011010 )
|
||||
, BOOST_BINARY( 011011 )
|
||||
, BOOST_BINARY( 011100 )
|
||||
, BOOST_BINARY( 011101 )
|
||||
, BOOST_BINARY( 011110 )
|
||||
, BOOST_BINARY( 011111 )
|
||||
, BOOST_BINARY( 100000 )
|
||||
, BOOST_BINARY( 100001 )
|
||||
, BOOST_BINARY( 100010 )
|
||||
, BOOST_BINARY( 100011 )
|
||||
, BOOST_BINARY( 100100 )
|
||||
, BOOST_BINARY( 100101 )
|
||||
, BOOST_BINARY( 100110 )
|
||||
, BOOST_BINARY( 100111 )
|
||||
, BOOST_BINARY( 101000 )
|
||||
, BOOST_BINARY( 101001 )
|
||||
, BOOST_BINARY( 101010 )
|
||||
, BOOST_BINARY( 101011 )
|
||||
, BOOST_BINARY( 101100 )
|
||||
, BOOST_BINARY( 101101 )
|
||||
, BOOST_BINARY( 101110 )
|
||||
, BOOST_BINARY( 101111 )
|
||||
, BOOST_BINARY( 110000 )
|
||||
, BOOST_BINARY( 110001 )
|
||||
, BOOST_BINARY( 110010 )
|
||||
, BOOST_BINARY( 110011 )
|
||||
, BOOST_BINARY( 110100 )
|
||||
, BOOST_BINARY( 110101 )
|
||||
, BOOST_BINARY( 110110 )
|
||||
, BOOST_BINARY( 110111 )
|
||||
, BOOST_BINARY( 111000 )
|
||||
, BOOST_BINARY( 111001 )
|
||||
, BOOST_BINARY( 111010 )
|
||||
, BOOST_BINARY( 111011 )
|
||||
, BOOST_BINARY( 111100 )
|
||||
, BOOST_BINARY( 111101 )
|
||||
, BOOST_BINARY( 111110 )
|
||||
, BOOST_BINARY( 111111 )
|
||||
};
|
||||
|
||||
unsigned int const unsigned_ints_7_bits[128] =
|
||||
{ BOOST_BINARY( 0000000 )
|
||||
, BOOST_BINARY( 0000001 )
|
||||
, BOOST_BINARY( 0000010 )
|
||||
, BOOST_BINARY( 0000011 )
|
||||
, BOOST_BINARY( 0000100 )
|
||||
, BOOST_BINARY( 0000101 )
|
||||
, BOOST_BINARY( 0000110 )
|
||||
, BOOST_BINARY( 0000111 )
|
||||
, BOOST_BINARY( 0001000 )
|
||||
, BOOST_BINARY( 0001001 )
|
||||
, BOOST_BINARY( 0001010 )
|
||||
, BOOST_BINARY( 0001011 )
|
||||
, BOOST_BINARY( 0001100 )
|
||||
, BOOST_BINARY( 0001101 )
|
||||
, BOOST_BINARY( 0001110 )
|
||||
, BOOST_BINARY( 0001111 )
|
||||
, BOOST_BINARY( 0010000 )
|
||||
, BOOST_BINARY( 0010001 )
|
||||
, BOOST_BINARY( 0010010 )
|
||||
, BOOST_BINARY( 0010011 )
|
||||
, BOOST_BINARY( 0010100 )
|
||||
, BOOST_BINARY( 0010101 )
|
||||
, BOOST_BINARY( 0010110 )
|
||||
, BOOST_BINARY( 0010111 )
|
||||
, BOOST_BINARY( 0011000 )
|
||||
, BOOST_BINARY( 0011001 )
|
||||
, BOOST_BINARY( 0011010 )
|
||||
, BOOST_BINARY( 0011011 )
|
||||
, BOOST_BINARY( 0011100 )
|
||||
, BOOST_BINARY( 0011101 )
|
||||
, BOOST_BINARY( 0011110 )
|
||||
, BOOST_BINARY( 0011111 )
|
||||
, BOOST_BINARY( 0100000 )
|
||||
, BOOST_BINARY( 0100001 )
|
||||
, BOOST_BINARY( 0100010 )
|
||||
, BOOST_BINARY( 0100011 )
|
||||
, BOOST_BINARY( 0100100 )
|
||||
, BOOST_BINARY( 0100101 )
|
||||
, BOOST_BINARY( 0100110 )
|
||||
, BOOST_BINARY( 0100111 )
|
||||
, BOOST_BINARY( 0101000 )
|
||||
, BOOST_BINARY( 0101001 )
|
||||
, BOOST_BINARY( 0101010 )
|
||||
, BOOST_BINARY( 0101011 )
|
||||
, BOOST_BINARY( 0101100 )
|
||||
, BOOST_BINARY( 0101101 )
|
||||
, BOOST_BINARY( 0101110 )
|
||||
, BOOST_BINARY( 0101111 )
|
||||
, BOOST_BINARY( 0110000 )
|
||||
, BOOST_BINARY( 0110001 )
|
||||
, BOOST_BINARY( 0110010 )
|
||||
, BOOST_BINARY( 0110011 )
|
||||
, BOOST_BINARY( 0110100 )
|
||||
, BOOST_BINARY( 0110101 )
|
||||
, BOOST_BINARY( 0110110 )
|
||||
, BOOST_BINARY( 0110111 )
|
||||
, BOOST_BINARY( 0111000 )
|
||||
, BOOST_BINARY( 0111001 )
|
||||
, BOOST_BINARY( 0111010 )
|
||||
, BOOST_BINARY( 0111011 )
|
||||
, BOOST_BINARY( 0111100 )
|
||||
, BOOST_BINARY( 0111101 )
|
||||
, BOOST_BINARY( 0111110 )
|
||||
, BOOST_BINARY( 0111111 )
|
||||
, BOOST_BINARY( 1000000 )
|
||||
, BOOST_BINARY( 1000001 )
|
||||
, BOOST_BINARY( 1000010 )
|
||||
, BOOST_BINARY( 1000011 )
|
||||
, BOOST_BINARY( 1000100 )
|
||||
, BOOST_BINARY( 1000101 )
|
||||
, BOOST_BINARY( 1000110 )
|
||||
, BOOST_BINARY( 1000111 )
|
||||
, BOOST_BINARY( 1001000 )
|
||||
, BOOST_BINARY( 1001001 )
|
||||
, BOOST_BINARY( 1001010 )
|
||||
, BOOST_BINARY( 1001011 )
|
||||
, BOOST_BINARY( 1001100 )
|
||||
, BOOST_BINARY( 1001101 )
|
||||
, BOOST_BINARY( 1001110 )
|
||||
, BOOST_BINARY( 1001111 )
|
||||
, BOOST_BINARY( 1010000 )
|
||||
, BOOST_BINARY( 1010001 )
|
||||
, BOOST_BINARY( 1010010 )
|
||||
, BOOST_BINARY( 1010011 )
|
||||
, BOOST_BINARY( 1010100 )
|
||||
, BOOST_BINARY( 1010101 )
|
||||
, BOOST_BINARY( 1010110 )
|
||||
, BOOST_BINARY( 1010111 )
|
||||
, BOOST_BINARY( 1011000 )
|
||||
, BOOST_BINARY( 1011001 )
|
||||
, BOOST_BINARY( 1011010 )
|
||||
, BOOST_BINARY( 1011011 )
|
||||
, BOOST_BINARY( 1011100 )
|
||||
, BOOST_BINARY( 1011101 )
|
||||
, BOOST_BINARY( 1011110 )
|
||||
, BOOST_BINARY( 1011111 )
|
||||
, BOOST_BINARY( 1100000 )
|
||||
, BOOST_BINARY( 1100001 )
|
||||
, BOOST_BINARY( 1100010 )
|
||||
, BOOST_BINARY( 1100011 )
|
||||
, BOOST_BINARY( 1100100 )
|
||||
, BOOST_BINARY( 1100101 )
|
||||
, BOOST_BINARY( 1100110 )
|
||||
, BOOST_BINARY( 1100111 )
|
||||
, BOOST_BINARY( 1101000 )
|
||||
, BOOST_BINARY( 1101001 )
|
||||
, BOOST_BINARY( 1101010 )
|
||||
, BOOST_BINARY( 1101011 )
|
||||
, BOOST_BINARY( 1101100 )
|
||||
, BOOST_BINARY( 1101101 )
|
||||
, BOOST_BINARY( 1101110 )
|
||||
, BOOST_BINARY( 1101111 )
|
||||
, BOOST_BINARY( 1110000 )
|
||||
, BOOST_BINARY( 1110001 )
|
||||
, BOOST_BINARY( 1110010 )
|
||||
, BOOST_BINARY( 1110011 )
|
||||
, BOOST_BINARY( 1110100 )
|
||||
, BOOST_BINARY( 1110101 )
|
||||
, BOOST_BINARY( 1110110 )
|
||||
, BOOST_BINARY( 1110111 )
|
||||
, BOOST_BINARY( 1111000 )
|
||||
, BOOST_BINARY( 1111001 )
|
||||
, BOOST_BINARY( 1111010 )
|
||||
, BOOST_BINARY( 1111011 )
|
||||
, BOOST_BINARY( 1111100 )
|
||||
, BOOST_BINARY( 1111101 )
|
||||
, BOOST_BINARY( 1111110 )
|
||||
, BOOST_BINARY( 1111111 )
|
||||
};
|
||||
unsigned int const unsigned_ints_8_bits[256] =
|
||||
{ BOOST_BINARY( 00000000 )
|
||||
, BOOST_BINARY( 00000001 )
|
||||
, BOOST_BINARY( 00000010 )
|
||||
, BOOST_BINARY( 00000011 )
|
||||
, BOOST_BINARY( 00000100 )
|
||||
, BOOST_BINARY( 00000101 )
|
||||
, BOOST_BINARY( 00000110 )
|
||||
, BOOST_BINARY( 00000111 )
|
||||
, BOOST_BINARY( 00001000 )
|
||||
, BOOST_BINARY( 00001001 )
|
||||
, BOOST_BINARY( 00001010 )
|
||||
, BOOST_BINARY( 00001011 )
|
||||
, BOOST_BINARY( 00001100 )
|
||||
, BOOST_BINARY( 00001101 )
|
||||
, BOOST_BINARY( 00001110 )
|
||||
, BOOST_BINARY( 00001111 )
|
||||
, BOOST_BINARY( 00010000 )
|
||||
, BOOST_BINARY( 00010001 )
|
||||
, BOOST_BINARY( 00010010 )
|
||||
, BOOST_BINARY( 00010011 )
|
||||
, BOOST_BINARY( 00010100 )
|
||||
, BOOST_BINARY( 00010101 )
|
||||
, BOOST_BINARY( 00010110 )
|
||||
, BOOST_BINARY( 00010111 )
|
||||
, BOOST_BINARY( 00011000 )
|
||||
, BOOST_BINARY( 00011001 )
|
||||
, BOOST_BINARY( 00011010 )
|
||||
, BOOST_BINARY( 00011011 )
|
||||
, BOOST_BINARY( 00011100 )
|
||||
, BOOST_BINARY( 00011101 )
|
||||
, BOOST_BINARY( 00011110 )
|
||||
, BOOST_BINARY( 00011111 )
|
||||
, BOOST_BINARY( 00100000 )
|
||||
, BOOST_BINARY( 00100001 )
|
||||
, BOOST_BINARY( 00100010 )
|
||||
, BOOST_BINARY( 00100011 )
|
||||
, BOOST_BINARY( 00100100 )
|
||||
, BOOST_BINARY( 00100101 )
|
||||
, BOOST_BINARY( 00100110 )
|
||||
, BOOST_BINARY( 00100111 )
|
||||
, BOOST_BINARY( 00101000 )
|
||||
, BOOST_BINARY( 00101001 )
|
||||
, BOOST_BINARY( 00101010 )
|
||||
, BOOST_BINARY( 00101011 )
|
||||
, BOOST_BINARY( 00101100 )
|
||||
, BOOST_BINARY( 00101101 )
|
||||
, BOOST_BINARY( 00101110 )
|
||||
, BOOST_BINARY( 00101111 )
|
||||
, BOOST_BINARY( 00110000 )
|
||||
, BOOST_BINARY( 00110001 )
|
||||
, BOOST_BINARY( 00110010 )
|
||||
, BOOST_BINARY( 00110011 )
|
||||
, BOOST_BINARY( 00110100 )
|
||||
, BOOST_BINARY( 00110101 )
|
||||
, BOOST_BINARY( 00110110 )
|
||||
, BOOST_BINARY( 00110111 )
|
||||
, BOOST_BINARY( 00111000 )
|
||||
, BOOST_BINARY( 00111001 )
|
||||
, BOOST_BINARY( 00111010 )
|
||||
, BOOST_BINARY( 00111011 )
|
||||
, BOOST_BINARY( 00111100 )
|
||||
, BOOST_BINARY( 00111101 )
|
||||
, BOOST_BINARY( 00111110 )
|
||||
, BOOST_BINARY( 00111111 )
|
||||
, BOOST_BINARY( 01000000 )
|
||||
, BOOST_BINARY( 01000001 )
|
||||
, BOOST_BINARY( 01000010 )
|
||||
, BOOST_BINARY( 01000011 )
|
||||
, BOOST_BINARY( 01000100 )
|
||||
, BOOST_BINARY( 01000101 )
|
||||
, BOOST_BINARY( 01000110 )
|
||||
, BOOST_BINARY( 01000111 )
|
||||
, BOOST_BINARY( 01001000 )
|
||||
, BOOST_BINARY( 01001001 )
|
||||
, BOOST_BINARY( 01001010 )
|
||||
, BOOST_BINARY( 01001011 )
|
||||
, BOOST_BINARY( 01001100 )
|
||||
, BOOST_BINARY( 01001101 )
|
||||
, BOOST_BINARY( 01001110 )
|
||||
, BOOST_BINARY( 01001111 )
|
||||
, BOOST_BINARY( 01010000 )
|
||||
, BOOST_BINARY( 01010001 )
|
||||
, BOOST_BINARY( 01010010 )
|
||||
, BOOST_BINARY( 01010011 )
|
||||
, BOOST_BINARY( 01010100 )
|
||||
, BOOST_BINARY( 01010101 )
|
||||
, BOOST_BINARY( 01010110 )
|
||||
, BOOST_BINARY( 01010111 )
|
||||
, BOOST_BINARY( 01011000 )
|
||||
, BOOST_BINARY( 01011001 )
|
||||
, BOOST_BINARY( 01011010 )
|
||||
, BOOST_BINARY( 01011011 )
|
||||
, BOOST_BINARY( 01011100 )
|
||||
, BOOST_BINARY( 01011101 )
|
||||
, BOOST_BINARY( 01011110 )
|
||||
, BOOST_BINARY( 01011111 )
|
||||
, BOOST_BINARY( 01100000 )
|
||||
, BOOST_BINARY( 01100001 )
|
||||
, BOOST_BINARY( 01100010 )
|
||||
, BOOST_BINARY( 01100011 )
|
||||
, BOOST_BINARY( 01100100 )
|
||||
, BOOST_BINARY( 01100101 )
|
||||
, BOOST_BINARY( 01100110 )
|
||||
, BOOST_BINARY( 01100111 )
|
||||
, BOOST_BINARY( 01101000 )
|
||||
, BOOST_BINARY( 01101001 )
|
||||
, BOOST_BINARY( 01101010 )
|
||||
, BOOST_BINARY( 01101011 )
|
||||
, BOOST_BINARY( 01101100 )
|
||||
, BOOST_BINARY( 01101101 )
|
||||
, BOOST_BINARY( 01101110 )
|
||||
, BOOST_BINARY( 01101111 )
|
||||
, BOOST_BINARY( 01110000 )
|
||||
, BOOST_BINARY( 01110001 )
|
||||
, BOOST_BINARY( 01110010 )
|
||||
, BOOST_BINARY( 01110011 )
|
||||
, BOOST_BINARY( 01110100 )
|
||||
, BOOST_BINARY( 01110101 )
|
||||
, BOOST_BINARY( 01110110 )
|
||||
, BOOST_BINARY( 01110111 )
|
||||
, BOOST_BINARY( 01111000 )
|
||||
, BOOST_BINARY( 01111001 )
|
||||
, BOOST_BINARY( 01111010 )
|
||||
, BOOST_BINARY( 01111011 )
|
||||
, BOOST_BINARY( 01111100 )
|
||||
, BOOST_BINARY( 01111101 )
|
||||
, BOOST_BINARY( 01111110 )
|
||||
, BOOST_BINARY( 01111111 )
|
||||
, BOOST_BINARY( 10000000 )
|
||||
, BOOST_BINARY( 10000001 )
|
||||
, BOOST_BINARY( 10000010 )
|
||||
, BOOST_BINARY( 10000011 )
|
||||
, BOOST_BINARY( 10000100 )
|
||||
, BOOST_BINARY( 10000101 )
|
||||
, BOOST_BINARY( 10000110 )
|
||||
, BOOST_BINARY( 10000111 )
|
||||
, BOOST_BINARY( 10001000 )
|
||||
, BOOST_BINARY( 10001001 )
|
||||
, BOOST_BINARY( 10001010 )
|
||||
, BOOST_BINARY( 10001011 )
|
||||
, BOOST_BINARY( 10001100 )
|
||||
, BOOST_BINARY( 10001101 )
|
||||
, BOOST_BINARY( 10001110 )
|
||||
, BOOST_BINARY( 10001111 )
|
||||
, BOOST_BINARY( 10010000 )
|
||||
, BOOST_BINARY( 10010001 )
|
||||
, BOOST_BINARY( 10010010 )
|
||||
, BOOST_BINARY( 10010011 )
|
||||
, BOOST_BINARY( 10010100 )
|
||||
, BOOST_BINARY( 10010101 )
|
||||
, BOOST_BINARY( 10010110 )
|
||||
, BOOST_BINARY( 10010111 )
|
||||
, BOOST_BINARY( 10011000 )
|
||||
, BOOST_BINARY( 10011001 )
|
||||
, BOOST_BINARY( 10011010 )
|
||||
, BOOST_BINARY( 10011011 )
|
||||
, BOOST_BINARY( 10011100 )
|
||||
, BOOST_BINARY( 10011101 )
|
||||
, BOOST_BINARY( 10011110 )
|
||||
, BOOST_BINARY( 10011111 )
|
||||
, BOOST_BINARY( 10100000 )
|
||||
, BOOST_BINARY( 10100001 )
|
||||
, BOOST_BINARY( 10100010 )
|
||||
, BOOST_BINARY( 10100011 )
|
||||
, BOOST_BINARY( 10100100 )
|
||||
, BOOST_BINARY( 10100101 )
|
||||
, BOOST_BINARY( 10100110 )
|
||||
, BOOST_BINARY( 10100111 )
|
||||
, BOOST_BINARY( 10101000 )
|
||||
, BOOST_BINARY( 10101001 )
|
||||
, BOOST_BINARY( 10101010 )
|
||||
, BOOST_BINARY( 10101011 )
|
||||
, BOOST_BINARY( 10101100 )
|
||||
, BOOST_BINARY( 10101101 )
|
||||
, BOOST_BINARY( 10101110 )
|
||||
, BOOST_BINARY( 10101111 )
|
||||
, BOOST_BINARY( 10110000 )
|
||||
, BOOST_BINARY( 10110001 )
|
||||
, BOOST_BINARY( 10110010 )
|
||||
, BOOST_BINARY( 10110011 )
|
||||
, BOOST_BINARY( 10110100 )
|
||||
, BOOST_BINARY( 10110101 )
|
||||
, BOOST_BINARY( 10110110 )
|
||||
, BOOST_BINARY( 10110111 )
|
||||
, BOOST_BINARY( 10111000 )
|
||||
, BOOST_BINARY( 10111001 )
|
||||
, BOOST_BINARY( 10111010 )
|
||||
, BOOST_BINARY( 10111011 )
|
||||
, BOOST_BINARY( 10111100 )
|
||||
, BOOST_BINARY( 10111101 )
|
||||
, BOOST_BINARY( 10111110 )
|
||||
, BOOST_BINARY( 10111111 )
|
||||
, BOOST_BINARY( 11000000 )
|
||||
, BOOST_BINARY( 11000001 )
|
||||
, BOOST_BINARY( 11000010 )
|
||||
, BOOST_BINARY( 11000011 )
|
||||
, BOOST_BINARY( 11000100 )
|
||||
, BOOST_BINARY( 11000101 )
|
||||
, BOOST_BINARY( 11000110 )
|
||||
, BOOST_BINARY( 11000111 )
|
||||
, BOOST_BINARY( 11001000 )
|
||||
, BOOST_BINARY( 11001001 )
|
||||
, BOOST_BINARY( 11001010 )
|
||||
, BOOST_BINARY( 11001011 )
|
||||
, BOOST_BINARY( 11001100 )
|
||||
, BOOST_BINARY( 11001101 )
|
||||
, BOOST_BINARY( 11001110 )
|
||||
, BOOST_BINARY( 11001111 )
|
||||
, BOOST_BINARY( 11010000 )
|
||||
, BOOST_BINARY( 11010001 )
|
||||
, BOOST_BINARY( 11010010 )
|
||||
, BOOST_BINARY( 11010011 )
|
||||
, BOOST_BINARY( 11010100 )
|
||||
, BOOST_BINARY( 11010101 )
|
||||
, BOOST_BINARY( 11010110 )
|
||||
, BOOST_BINARY( 11010111 )
|
||||
, BOOST_BINARY( 11011000 )
|
||||
, BOOST_BINARY( 11011001 )
|
||||
, BOOST_BINARY( 11011010 )
|
||||
, BOOST_BINARY( 11011011 )
|
||||
, BOOST_BINARY( 11011100 )
|
||||
, BOOST_BINARY( 11011101 )
|
||||
, BOOST_BINARY( 11011110 )
|
||||
, BOOST_BINARY( 11011111 )
|
||||
, BOOST_BINARY( 11100000 )
|
||||
, BOOST_BINARY( 11100001 )
|
||||
, BOOST_BINARY( 11100010 )
|
||||
, BOOST_BINARY( 11100011 )
|
||||
, BOOST_BINARY( 11100100 )
|
||||
, BOOST_BINARY( 11100101 )
|
||||
, BOOST_BINARY( 11100110 )
|
||||
, BOOST_BINARY( 11100111 )
|
||||
, BOOST_BINARY( 11101000 )
|
||||
, BOOST_BINARY( 11101001 )
|
||||
, BOOST_BINARY( 11101010 )
|
||||
, BOOST_BINARY( 11101011 )
|
||||
, BOOST_BINARY( 11101100 )
|
||||
, BOOST_BINARY( 11101101 )
|
||||
, BOOST_BINARY( 11101110 )
|
||||
, BOOST_BINARY( 11101111 )
|
||||
, BOOST_BINARY( 11110000 )
|
||||
, BOOST_BINARY( 11110001 )
|
||||
, BOOST_BINARY( 11110010 )
|
||||
, BOOST_BINARY( 11110011 )
|
||||
, BOOST_BINARY( 11110100 )
|
||||
, BOOST_BINARY( 11110101 )
|
||||
, BOOST_BINARY( 11110110 )
|
||||
, BOOST_BINARY( 11110111 )
|
||||
, BOOST_BINARY( 11111000 )
|
||||
, BOOST_BINARY( 11111001 )
|
||||
, BOOST_BINARY( 11111010 )
|
||||
, BOOST_BINARY( 11111011 )
|
||||
, BOOST_BINARY( 11111100 )
|
||||
, BOOST_BINARY( 11111101 )
|
||||
, BOOST_BINARY( 11111110 )
|
||||
, BOOST_BINARY( 11111111 )
|
||||
};
|
||||
|
||||
struct left_is_not_one_less_than_right
|
||||
{
|
||||
bool operator ()( unsigned int left, unsigned int right ) const
|
||||
{
|
||||
return right != left + 1;
|
||||
}
|
||||
};
|
||||
|
||||
template< std::size_t Size >
|
||||
bool is_ascending_from_0_array( unsigned int const (&array)[Size] )
|
||||
{
|
||||
unsigned int const* const curr = array,
|
||||
* const end = array + Size;
|
||||
|
||||
return ( *curr == 0 )
|
||||
&& ( std::adjacent_find( curr, end
|
||||
, left_is_not_one_less_than_right()
|
||||
)
|
||||
== end
|
||||
);
|
||||
}
|
||||
|
||||
std::size_t const unsigned_int_id = 1,
|
||||
unsigned_long_int_id = 2;
|
||||
|
||||
typedef char (&unsigned_int_id_type)[unsigned_int_id];
|
||||
typedef char (&unsigned_long_int_id_type)[unsigned_long_int_id];
|
||||
|
||||
// Note: Functions only used for type checking
|
||||
unsigned_int_id_type binary_type_checker( unsigned int );
|
||||
unsigned_long_int_id_type binary_type_checker( unsigned long int );
|
||||
|
||||
int test_main( int, char *[] )
|
||||
{
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_1_bit ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_2_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_3_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_4_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_5_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_6_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_7_bits ) );
|
||||
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_8_bits ) );
|
||||
|
||||
BOOST_CHECK( std::equal( &random_unsigned_ints_hex[0]
|
||||
, random_unsigned_ints_hex + num_random_test_values
|
||||
, &random_unsigned_ints_binary[0]
|
||||
)
|
||||
);
|
||||
|
||||
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_U( 110100 1010 ) ) )
|
||||
== unsigned_int_id
|
||||
);
|
||||
|
||||
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_UL( 11110 ) ) )
|
||||
== unsigned_long_int_id
|
||||
);
|
||||
|
||||
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_LU( 10 0001 ) ) )
|
||||
== unsigned_long_int_id
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
@ -740,26 +740,16 @@ specialisation).</p>
|
||||
|
||||
<p>Revised 01 September 2000</p>
|
||||
|
||||
<p><EFBFBD> Copyright boost.org 2000. Permission to copy, use, modify,
|
||||
sell and distribute this document is granted provided this
|
||||
copyright notice appears in all copies. This document is provided
|
||||
"as is" without express or implied warranty, and with
|
||||
no claim as to its suitability for any purpose.</p>
|
||||
|
||||
<p>Based on contributions by Steve Cleary, Beman Dawes, Howard
|
||||
Hinnant and John Maddock.</p>
|
||||
|
||||
<p>Maintained by <a href="mailto:john@johnmaddock.co.uk">John
|
||||
Maddock</a>, the latest version of this file can be found at <a
|
||||
href="http://www.boost.org/">www.boost.org</a>, and the boost
|
||||
discussion list at <a
|
||||
href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>.</p>
|
||||
|
||||
<p>.</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p> </p>
|
||||
<p>
|
||||
Copyright 2000 Steve Cleary, Beman Dawes, Howard
|
||||
Hinnant and John Maddock. <br/>
|
||||
Use, modification and distribution are subject to the
|
||||
Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt
|
||||
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
</a>).
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include <libs/type_traits/test/test.hpp>
|
||||
#include <libs/type_traits/test/check_type.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4181) // : warning C4181: qualifier applied to reference type; ignored
|
||||
#endif
|
||||
|
||||
// a way prevent warnings for unused variables
|
||||
template<class T> inline void unused_variable(const T&) {}
|
||||
|
||||
@ -52,7 +56,8 @@ struct contained
|
||||
const_reference const_get()const { return v_; }
|
||||
// pass value:
|
||||
void call(param_type){}
|
||||
|
||||
private:
|
||||
contained& operator=(const contained&);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
@ -77,6 +82,8 @@ struct contained<T[N]>
|
||||
reference get() { return v_; }
|
||||
const_reference const_get()const { return v_; }
|
||||
void call(param_type){}
|
||||
private:
|
||||
contained& operator=(const contained&);
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -197,14 +204,16 @@ struct comparible_UDT
|
||||
bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[ ])
|
||||
int main()
|
||||
{
|
||||
call_traits_checker<comparible_UDT> c1;
|
||||
comparible_UDT u;
|
||||
c1(u);
|
||||
call_traits_checker<int> c2;
|
||||
call_traits_checker<enum_UDT> c2b;
|
||||
int i = 2;
|
||||
c2(i);
|
||||
c2b(one);
|
||||
int* pi = &i;
|
||||
int a[2] = {1,2};
|
||||
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) && !defined(__ICL)
|
||||
@ -285,7 +294,11 @@ int main(int argc, char *argv[ ])
|
||||
BOOST_CHECK_TYPE(incomplete_type&, boost::call_traits<incomplete_type>::reference);
|
||||
BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference);
|
||||
BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::param_type);
|
||||
|
||||
// test enum:
|
||||
BOOST_CHECK_TYPE(enum_UDT, boost::call_traits<enum_UDT>::value_type);
|
||||
BOOST_CHECK_TYPE(enum_UDT&, boost::call_traits<enum_UDT>::reference);
|
||||
BOOST_CHECK_TYPE(const enum_UDT&, boost::call_traits<enum_UDT>::const_reference);
|
||||
BOOST_CHECK_TYPE(const enum_UDT, boost::call_traits<enum_UDT>::param_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<title>Header </title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="Template" content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
||||
<boostcompressed_pair.hpp>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080">
|
||||
@ -59,17 +59,18 @@ public:
|
||||
empty type, then assigning to that member will produce memory corruption,
|
||||
unless the empty type has a "do nothing" assignment operator defined. This is
|
||||
due to a bug in the way VC6 generates implicit assignment operators.</p>
|
||||
<hr>
|
||||
<p>Revised 08 May 2001</p>
|
||||
<p><EFBFBD> Copyright boost.org 2000. Permission to copy, use, modify, sell and
|
||||
distribute this document is granted provided this copyright notice appears in
|
||||
all copies. This document is provided "as is" without express or implied
|
||||
warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
<h3>Acknowledgements</h3>
|
||||
<p>Based on contributions by Steve Cleary, Beman Dawes, Howard Hinnant and John
|
||||
Maddock.</p>
|
||||
<p>Maintained by <a href="mailto:john@johnmaddock.co.uk">John Maddock</a>, the
|
||||
latest version of this file can be found at <a href="http://www.boost.org">www.boost.org</a>,
|
||||
and the boost discussion list at <a href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>.</p>
|
||||
<p> </p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->07 November 2007<!--webbot bot="Timestamp" endspan i-checksum="40338" --></p>
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2000.</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
68
doc/Jamfile.v2
Normal file
68
doc/Jamfile.v2
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
# Copyright John Maddock 2005. Use, modification, and distribution are
|
||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
project : requirements
|
||||
# Path for links to Boost:
|
||||
<xsl:param>boost.root=../../../..
|
||||
|
||||
# Some general style settings:
|
||||
<xsl:param>table.footnote.number.format=1
|
||||
<xsl:param>footnote.number.format=1
|
||||
|
||||
# HTML options first:
|
||||
# Use graphics not text for navigation:
|
||||
<xsl:param>navig.graphics=1
|
||||
# PDF Options:
|
||||
# TOC Generation: this is needed for FOP-0.9 and later:
|
||||
<xsl:param>fop1.extensions=0
|
||||
<xsl:param>xep.extensions=1
|
||||
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
|
||||
<xsl:param>fop.extensions=0
|
||||
# No indent on body text:
|
||||
<xsl:param>body.start.indent=0pt
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.inner=0.5in
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.outer=0.5in
|
||||
# Paper type = A4
|
||||
<xsl:param>paper.type=A4
|
||||
# Yes, we want graphics for admonishments:
|
||||
<xsl:param>admon.graphics=1
|
||||
# Set this one for PDF generation *only*:
|
||||
# default pnd graphics are awful in PDF form,
|
||||
# better use SVG's instead:
|
||||
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||
<format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/utility/doc/html
|
||||
;
|
||||
|
||||
using quickbook ;
|
||||
|
||||
path-constant boost-images : ../../../doc/src/images ;
|
||||
|
||||
xml declval : declval.qbk ;
|
||||
boostbook standalone
|
||||
:
|
||||
declval
|
||||
:
|
||||
# File name of HTML output:
|
||||
<xsl:param>root.filename=declval
|
||||
# How far down we chunk nested sections, basically all of them:
|
||||
<xsl:param>chunk.section.depth=0
|
||||
# Don't put the first section on the same page as the TOC:
|
||||
<xsl:param>chunk.first.sections=0
|
||||
# How far down sections get TOC's
|
||||
<xsl:param>toc.section.depth=1
|
||||
# Max depth in each TOC:
|
||||
<xsl:param>toc.max.depth=1
|
||||
# How far down we go with TOC's
|
||||
<xsl:param>generate.section.toc.level=1
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
104
doc/declval.qbk
Normal file
104
doc/declval.qbk
Normal file
@ -0,0 +1,104 @@
|
||||
[/
|
||||
/ Copyright (c) 2008 Howard Hinnant
|
||||
/ Copyright (c) 2008 Beman Dawes
|
||||
/ Copyright (c) 2009-20010 Vicente J. Botet Escriba
|
||||
/
|
||||
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
/]
|
||||
|
||||
[article Declval
|
||||
[quickbook 1.5]
|
||||
[authors [Hinnant, Howard]]
|
||||
[authors [Dawes, Beman]]
|
||||
[authors [Botet Escriba, Vicente J.]]
|
||||
[copyright 2008 Howard Hinnant]
|
||||
[copyright 2008 Beman Dawes]
|
||||
[copyright 2009-2010 Vicente J. Botet Escriba]
|
||||
[license
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
[@http://www.boost.org/LICENSE_1_0.txt])
|
||||
]
|
||||
]
|
||||
|
||||
[/===============]
|
||||
[section Overview]
|
||||
[/===============]
|
||||
|
||||
The motivation for `declval` was introduced in [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2958.html#Value N2958:
|
||||
Moving Swap Forward]. Here follows a rewording of this chapter.
|
||||
|
||||
With the provision of decltype, late-specified return types, and default template-arguments for function templates a
|
||||
new generation of SFINAE patterns will emerge to at least partially compensate the lack of concepts on the C++0x timescale.
|
||||
Using this technique, it is sometimes necessary to obtain an object of a known type in a non-using context, e.g. given the declaration
|
||||
|
||||
template<class T>
|
||||
T&& declval(); // not used
|
||||
|
||||
as part of the function template declaration
|
||||
|
||||
template<class To, class From>
|
||||
decltype(static_cast<To>(declval<From>())) convert(From&&);
|
||||
|
||||
or as part of a class template definition
|
||||
|
||||
template<class> class result_of;
|
||||
|
||||
template<class Fn, class... ArgTypes>
|
||||
struct result_of<Fn(ArgTypes...)>
|
||||
{
|
||||
typedef decltype(declval<Fn>()(declval<ArgTypes>()...)) type;
|
||||
};
|
||||
|
||||
The role of the function template declval() is a transformation of a type T into a value without using or evaluating this function.
|
||||
The name is supposed to direct the reader's attention to the fact that the expression `declval<T>()` is an lvalue if and only if
|
||||
T is an lvalue-reference, otherwise an rvalue. To extend the domain of this function we can do a bit better by changing its declaration to
|
||||
|
||||
template<class T>
|
||||
typename std::add_rvalue_reference<T>::type declval(); // not used
|
||||
|
||||
which ensures that we can also use cv void as template parameter. The careful reader might have noticed that `declval()`
|
||||
already exists under the name create() as part of the definition of the semantics of the type trait is_convertible in the C++0x standard.
|
||||
|
||||
The provision of a new library component that allows the production of values in unevaluated expressions is considered
|
||||
important to realize constrained templates in C++0x where concepts are not available.
|
||||
This extremely light-weight function is expected to be part of the daily tool-box of the C++0x programmer.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[/=================]
|
||||
[section:reference Reference ]
|
||||
[/=================]
|
||||
|
||||
`#include <boost/utility/declval.hpp>`
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
The library provides the function template declval to simplify the definition of expressions which occur as unevaluated operands.
|
||||
|
||||
template <typename T>
|
||||
typename add_rvalue_reference<T>::type declval();
|
||||
|
||||
[*Remarks:] If this function is used, the program is ill-formed.
|
||||
|
||||
[*Remarks:] The template parameter T of declval may be an incomplete type.
|
||||
|
||||
[*Example:]
|
||||
|
||||
template <class To, class From>
|
||||
decltype(static_cast<To>(declval<From>())) convert(From&&);
|
||||
|
||||
Declares a function template convert which only participates in overloading if the type From can be explicitly converted to type To.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
163
doc/html/declval.html
Normal file
163
doc/html/declval.html
Normal file
@ -0,0 +1,163 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Declval</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="declval.html" title="Declval">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"></div>
|
||||
<div class="article">
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><h2 class="title">
|
||||
<a name="declval"></a>Declval</h2></div>
|
||||
<div><div class="authorgroup">
|
||||
<div class="author"><h3 class="author">
|
||||
<span class="firstname">Howard</span> <span class="surname">Hinnant</span>
|
||||
</h3></div>
|
||||
<div class="author"><h3 class="author">
|
||||
<span class="firstname">Beman</span> <span class="surname">Dawes</span>
|
||||
</h3></div>
|
||||
<div class="author"><h3 class="author">
|
||||
<span class="firstname">Vicente J.</span> <span class="surname">Botet Escriba</span>
|
||||
</h3></div>
|
||||
</div></div>
|
||||
<div><p class="copyright">Copyright © 2008 Howard Hinnant</p></div>
|
||||
<div><p class="copyright">Copyright © 2008 Beman Dawes</p></div>
|
||||
<div><p class="copyright">Copyright © 2009, 2010 Vicente J. Botet Escriba</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id3354293"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="toc">
|
||||
<p><b>Table of Contents</b></p>
|
||||
<dl>
|
||||
<dt><span class="section"><a href="declval.html#declval.overview">Overview</a></span></dt>
|
||||
<dt><span class="section"><a href="declval.html#declval.reference">Reference </a></span></dt>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="declval.overview"></a><a class="link" href="declval.html#declval.overview" title="Overview">Overview</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
The motivation for <code class="computeroutput"><span class="identifier">declval</span></code>
|
||||
was introduced in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2958.html#Value" target="_top">N2958:
|
||||
Moving Swap Forward</a>. Here follows a rewording of this chapter.
|
||||
</p>
|
||||
<p>
|
||||
With the provision of decltype, late-specified return types, and default template-arguments
|
||||
for function templates a new generation of SFINAE patterns will emerge to at
|
||||
least partially compensate the lack of concepts on the C++0x timescale. Using
|
||||
this technique, it is sometimes necessary to obtain an object of a known type
|
||||
in a non-using context, e.g. given the declaration
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">T</span><span class="special">&&</span> <span class="identifier">declval</span><span class="special">();</span> <span class="comment">// not used
|
||||
</span></pre>
|
||||
<p>
|
||||
as part of the function template declaration
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">To</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">From</span><span class="special">></span>
|
||||
<span class="identifier">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">To</span><span class="special">>(</span><span class="identifier">declval</span><span class="special"><</span><span class="identifier">From</span><span class="special">>()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
or as part of a class template definition
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span><span class="special">></span> <span class="keyword">class</span> <span class="identifier">result_of</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Fn</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">ArgTypes</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">result_of</span><span class="special"><</span><span class="identifier">Fn</span><span class="special">(</span><span class="identifier">ArgTypes</span><span class="special">...)></span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">decltype</span><span class="special">(</span><span class="identifier">declval</span><span class="special"><</span><span class="identifier">Fn</span><span class="special">>()(</span><span class="identifier">declval</span><span class="special"><</span><span class="identifier">ArgTypes</span><span class="special">>()...))</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
The role of the function template declval() is a transformation of a type T
|
||||
into a value without using or evaluating this function. The name is supposed
|
||||
to direct the reader's attention to the fact that the expression <code class="computeroutput"><span class="identifier">declval</span><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span></code> is
|
||||
an lvalue if and only if T is an lvalue-reference, otherwise an rvalue. To
|
||||
extend the domain of this function we can do a bit better by changing its declaration
|
||||
to
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">add_rvalue_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">();</span> <span class="comment">// not used
|
||||
</span></pre>
|
||||
<p>
|
||||
which ensures that we can also use cv void as template parameter. The careful
|
||||
reader might have noticed that <code class="computeroutput"><span class="identifier">declval</span><span class="special">()</span></code> already exists under the name create() as
|
||||
part of the definition of the semantics of the type trait is_convertible in
|
||||
the C++0x standard.
|
||||
</p>
|
||||
<p>
|
||||
The provision of a new library component that allows the production of values
|
||||
in unevaluated expressions is considered important to realize constrained templates
|
||||
in C++0x where concepts are not available. This extremely light-weight function
|
||||
is expected to be part of the daily tool-box of the C++0x programmer.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="declval.reference"></a><a class="link" href="declval.html#declval.reference" title="Reference">Reference </a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">declval</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <span class="identifier">add_rvalue_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">();</span> <span class="comment">//noexcept; // as unevaluated operand
|
||||
</span>
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<p>
|
||||
The library provides the function template declval to simplify the definition
|
||||
of expressions which occur as unevaluated operands.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <span class="identifier">add_rvalue_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Remarks:</strong></span> If this function is used, the program
|
||||
is ill-formed.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Remarks:</strong></span> The template parameter T of declval
|
||||
may be an incomplete type.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example:</strong></span>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">To</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">From</span><span class="special">></span>
|
||||
<span class="identifier">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">To</span><span class="special">>(</span><span class="identifier">declval</span><span class="special"><</span><span class="identifier">From</span><span class="special">>()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Declares a function template convert which only participates in overloading
|
||||
if the type From can be explicitly converted to type To.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: April 06, 2011 at 20:06:10 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"></div>
|
||||
</body>
|
||||
</html>
|
128
enable_if.html
128
enable_if.html
@ -21,6 +21,7 @@
|
||||
<BR>
|
||||
<BR>
|
||||
Copyright 2003 Jaakko Järvi, Jeremiah Willcock, Andrew Lumsdaine.<BR>
|
||||
Copyright 2011 Matt Calabrese.<BR>
|
||||
<BR>
|
||||
<!--TOC section Introduction-->
|
||||
|
||||
@ -81,7 +82,7 @@ definitions to find this out. Instantiating the latter definition with
|
||||
<PRE>int::result_type negate(const int&);
|
||||
|
||||
</PRE>
|
||||
where the return type is invalid. If this was an error, adding an unrelated function template
|
||||
where the return type is invalid. If this were an error, adding an unrelated function template
|
||||
(that was never called) could break otherwise valid code.
|
||||
Due to the SFINAE principle the above example is not, however, erroneous.
|
||||
The latter definition of <TT>negate</TT> is simply removed from the overload resolution set.<BR>
|
||||
@ -154,6 +155,7 @@ typename enable_if<boost::is_arithmetic<T>, T>::type
|
||||
foo(T t) { return t; }
|
||||
|
||||
</PRE>
|
||||
|
||||
<!--TOC section Using <TT>enable_if</TT>-->
|
||||
|
||||
<H2><A NAME="htoc5">3</A> Using <TT>enable_if</TT></H2><!--SEC END -->
|
||||
@ -162,8 +164,19 @@ foo(T t) { return t; }
|
||||
The <TT>enable_if</TT> templates are defined in
|
||||
<TT>boost/utility/enable_if.hpp</TT>, which is included by <TT>boost/utility.hpp</TT>.<BR>
|
||||
<BR>
|
||||
The <TT>enable_if</TT> template can be used either as the return type, or as an
|
||||
extra argument. For example, the <TT>foo</TT> function in the previous section could also be written
|
||||
With respect to function templates, <TT>enable_if</TT> can be used in multiple different ways:
|
||||
|
||||
<UL>
|
||||
<LI>As the return type of an instantiatied function
|
||||
<LI>As an extra parameter of an instantiated function
|
||||
<LI>As an extra template parameter (useful only in a compiler that supports C++0x default
|
||||
arguments for function template parameters, see <A href="#sec:enable_if_0x">Enabling function
|
||||
templates in C++0x</a> for details)
|
||||
</UL>
|
||||
|
||||
In the previous section, the return type form of <TT>enable_if</TT> was shown. As an example
|
||||
of using the form of <TT>enable_if</TT> that works via an extra function parameter, the
|
||||
<TT>foo</TT> function in the previous section could also be written
|
||||
as:
|
||||
<PRE>template <class T>
|
||||
T foo(T t, typename enable_if<boost::is_arithmetic<T> >::type* dummy = 0);
|
||||
@ -173,18 +186,80 @@ a default value to keep the parameter hidden from client code.
|
||||
Note that the second template argument was not given to <TT>enable_if</TT>, as the default
|
||||
<TT>void</TT> gives the desired behavior.<BR>
|
||||
<BR>
|
||||
Whether to write the enabler as an argument or within the return type is
|
||||
largely a matter of taste, but for certain functions, only one
|
||||
alternative is possible:
|
||||
Which way to write the enabler is largely a matter of taste, but for certain functions, only a
|
||||
subset of the options is possible:
|
||||
<UL><LI>
|
||||
Operators have a fixed number of arguments, thus <TT>enable_if</TT> must be used in the return type.
|
||||
<LI>Constructors and destructors do not have a return type; an extra argument is the only option.
|
||||
<LI>There does not seem to be a way to specify an enabler for a conversion operator. Converting constructors,
|
||||
however, can have enablers as extra default arguments.
|
||||
Many operators have a fixed number of arguments, thus <TT>enable_if</TT> must be used either in the
|
||||
return type or in an extra template parameter.
|
||||
<LI>Functions that have a variadic parameter list must use either the return type form or an extra
|
||||
template parameter.
|
||||
<LI>Constructors do not have a return type so you must use either an extra function parameter or an
|
||||
extra template parameter.
|
||||
<LI>Constructors that have a variadic parameter list must an extra template parameter.
|
||||
<LI>Conversion operators can only be written with an extra template parameter.
|
||||
</UL>
|
||||
<!--TOC subsection Enabling function templates in C++0x-->
|
||||
|
||||
<A NAME="sec:enable_if_0x"></A>
|
||||
<H3><A NAME="htoc7">3.1</A> Enabling function templates in C++0x</H3><!--SEC END -->
|
||||
|
||||
In a compiler which supports C++0x default arguments for function template parameters, you can
|
||||
enable and disable function templates by adding an additional template parameter. This approach
|
||||
works in all situations where you would use either the return type form of <TT>enable_if</TT> or
|
||||
the function parameter form, including operators, constructors, variadic function templates, and
|
||||
even overloaded conversion operations.
|
||||
|
||||
As an example:
|
||||
|
||||
<PRE>#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
class test
|
||||
{
|
||||
public:
|
||||
// A constructor that works for any argument list of size 10
|
||||
template< class... T
|
||||
, typename boost::enable_if_c< sizeof...( T ) == 10, int >::type = 0
|
||||
>
|
||||
test( T&&... );
|
||||
|
||||
// A conversion operation that can convert to any arithmetic type
|
||||
template< class T
|
||||
, typename boost::enable_if< boost::is_arithmetic< T >, int >::type = 0
|
||||
>
|
||||
operator T() const;
|
||||
|
||||
// A conversion operation that can convert to any pointer type
|
||||
template< class T
|
||||
, typename boost::enable_if< boost::is_pointer< T >, int >::type = 0
|
||||
>
|
||||
operator T() const;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// Works
|
||||
test test_( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
|
||||
|
||||
// Fails as expected
|
||||
test fail_construction( 1, 2, 3, 4, 5 );
|
||||
|
||||
// Works by calling the conversion operator enabled for arithmetic types
|
||||
int arithmetic_object = test_;
|
||||
|
||||
// Works by calling the conversion operator enabled for pointer types
|
||||
int* pointer_object = test_;
|
||||
|
||||
// Fails as expected
|
||||
struct {} fail_conversion = test_;
|
||||
}
|
||||
|
||||
</PRE>
|
||||
|
||||
<!--TOC subsection Enabling template class specializations-->
|
||||
|
||||
<H3><A NAME="htoc6">3.1</A> Enabling template class specializations</H3><!--SEC END -->
|
||||
<H3><A NAME="htoc7">3.2</A> Enabling template class specializations</H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:enable_if_classes"></A>
|
||||
Class template specializations can be enabled or disabled with <TT>enable_if</TT>.
|
||||
@ -210,7 +285,7 @@ is the correct value.<BR>
|
||||
<BR>
|
||||
<!--TOC subsection Overlapping enabler conditions-->
|
||||
|
||||
<H3><A NAME="htoc7">3.2</A> Overlapping enabler conditions</H3><!--SEC END -->
|
||||
<H3><A NAME="htoc8">3.3</A> Overlapping enabler conditions</H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:overlapping_conditions"></A>
|
||||
Once the compiler has examined the enabling conditions and included the
|
||||
@ -239,7 +314,7 @@ partial specializations as well.<BR>
|
||||
<BR>
|
||||
<!--TOC subsection Lazy <TT>enable_if</TT>-->
|
||||
|
||||
<H3><A NAME="htoc8">3.3</A> Lazy <TT>enable_if</TT></H3><!--SEC END -->
|
||||
<H3><A NAME="htoc9">3.4</A> Lazy <TT>enable_if</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:enable_if_lazy"></A>
|
||||
In some cases it is necessary to avoid instantiating part of a
|
||||
@ -285,7 +360,7 @@ above example, <TT>is_multipliable<T, U>::value</TT> defines when
|
||||
<BR>
|
||||
<!--TOC subsection Compiler workarounds-->
|
||||
|
||||
<H3><A NAME="htoc9">3.4</A> Compiler workarounds</H3><!--SEC END -->
|
||||
<H3><A NAME="htoc10">3.5</A> Compiler workarounds</H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:workarounds"></A>
|
||||
Some compilers flag functions as ambiguous if the only distinguishing factor is a different
|
||||
@ -366,17 +441,18 @@ David Vandevoorde and Nicolai M. Josuttis.
|
||||
<EM>C++ Templates: The Complete Guide</EM>.
|
||||
Addison-Wesley, 2002.</DL>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr></hr>
|
||||
|
||||
<B>Contributed by:</B> <BR>
|
||||
Jaakko Järvi, Jeremiah Willcock and Andrew Lumsdaine<BR>
|
||||
<EM>{jajarvi|jewillco|lums}@osl.iu.edu</EM><BR>
|
||||
Indiana University<BR>
|
||||
Open Systems Lab
|
||||
<hr/>
|
||||
<p>Copyright Jaakko Järvi<sup>*</sup>, Jeremiah Willcock<sup>*</sup>, Andrew Lumsdaine<sup>*</sup>, Matt Calabrese<BR>
|
||||
<EM>{jajarvi|jewillco|lums}@osl.iu.edu, rivorus@gmail.com</EM><BR>
|
||||
<sup>*</sup>Indiana University<BR>
|
||||
Open Systems Lab<br/>
|
||||
Use, modification and distribution are subject to the
|
||||
Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt
|
||||
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
</a>).
|
||||
</p>
|
||||
<!--HTMLFOOT-->
|
||||
<!--ENDHTML-->
|
||||
<!--FOOTER-->
|
||||
@ -385,4 +461,4 @@ Open Systems Lab
|
||||
</EM><A HREF="http://pauillac.inria.fr/~maranget/hevea/index.html"><EM>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A</EM></A><EM>.
|
||||
</EM></BLOCKQUOTE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</HTML>
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
@ -146,14 +146,14 @@ int main()
|
||||
<hr>
|
||||
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
||||
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||
height="31" width="88"></a></p>
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p>
|
||||
|
||||
<p><i>Copyright © 2001 <a href=
|
||||
"../../people/jens_maurer.htm">Jens Maurer</a></i></p>
|
||||
"http://www.boost.org/people/jens_maurer.htm">Jens Maurer</a></i></p>
|
||||
|
||||
<p><i>Distributed under the Boost Software License, Version 1.0. (See
|
||||
accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
|
||||
|
31
identity_type/doc/Jamfile.v2
Normal file
31
identity_type/doc/Jamfile.v2
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
# Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0
|
||||
# (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
# Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
import quickbook ;
|
||||
using boostbook ;
|
||||
|
||||
doxygen reference : ../../../../boost/utility/identity_type.hpp
|
||||
: <reftitle>"Reference"
|
||||
<doxygen:param>PREDEFINED="DOXYGEN"
|
||||
<doxygen:param>QUIET=YES
|
||||
<doxygen:param>WARN_IF_UNDOCUMENTED=NO
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
<doxygen:param>HIDE_UNDOC_CLASSES=YES
|
||||
<doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='boost_utility_identitytype.\\1'>\\1</link>\\endxmlonly\" RefSectId{2}=\"\\xmlonly<link linkend='boost_utility_identitytype.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
|
||||
;
|
||||
|
||||
# This target must be called "index" so to generate "index.html" file.
|
||||
xml index : identity_type.qbk : <dependency>reference ;
|
||||
|
||||
boostbook doc : index
|
||||
: <location>html
|
||||
<format>onehtml
|
||||
<xsl:param>toc.section.depth=0
|
||||
<xsl:param>html.stylesheet=../../../../../doc/src/boostbook.css
|
||||
<xsl:param>boost.root=../../../../..
|
||||
;
|
||||
|
237
identity_type/doc/html/index.html
Normal file
237
identity_type/doc/html/index.html
Normal file
@ -0,0 +1,237 @@
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Boost.Utility/IdentityType 1.0.0</title><link rel="stylesheet" type="text/css" href="../../../../../doc/src/boostbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" title="Boost.Utility/IdentityType 1.0.0"><div class="titlepage"><div><div><h2 class="title"><a name="boost_utility_identitytype"></a>Boost.Utility/IdentityType 1.0.0</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Lorenzo</span> <span class="surname">Caminiti <code class="email"><<a class="email" href="mailto:lorcaminiti@gmail.com">lorcaminiti@gmail.com</a>></code></span></h3></div></div><div><p class="copyright">Copyright © 2009-2012 Lorenzo
|
||||
Caminiti</p></div><div><div class="legalnotice" title="Legal Notice"><a name="boost_utility_identitytype.legal"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#boost_utility_identitytype.motivation">Motivation</a></span></dt><dt><span class="section"><a href="#boost_utility_identitytype.solution">Solution</a></span></dt><dt><span class="section"><a href="#boost_utility_identitytype.templates">Templates</a></span></dt><dt><span class="section"><a href="#boost_utility_identitytype.abstract_types">Abstract Types</a></span></dt><dt><span class="section"><a href="#boost_utility_identitytype.annex__usage">Annex: Usage</a></span></dt><dt><span class="section"><a href="#boost_utility_identitytype.annex__implementation">Annex:
|
||||
Implementation</a></span></dt><dt><span class="section"><a href="#reference">Reference</a></span></dt></dl></div><p>
|
||||
This library allows to wrap type expressions within round parenthesis so they
|
||||
can be passed to macros even when they contain commas.
|
||||
</p><div class="section boost_utility_identitytype_motivation" title="Motivation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.motivation"></a><a class="link" href="#boost_utility_identitytype.motivation" title="Motivation">Motivation</a></h2></div></div></div><p>
|
||||
Consider the following macro which declares a variable named <code class="computeroutput"><span class="identifier">var</span></code><code class="literal"><span class="emphasis"><em>n</em></span></code>
|
||||
with the specified <code class="literal"><span class="emphasis"><em>type</em></span></code> (see also
|
||||
<a href="../../test/var_error.cpp" target="_top"><code class="literal">var_error.cpp</code></a>):
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">VAR</span><span class="special">(</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">n</span><span class="special">)</span> <span class="identifier">type</span> <span class="identifier">var</span> <span class="error">#</span><span class="preprocessor"># n</span>
|
||||
|
||||
<span class="identifier">VAR</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// OK.</span>
|
||||
<span class="identifier">VAR</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">>,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// Error.</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
The first macro invocation works correctly declaring a variable named <code class="computeroutput"><span class="identifier">var1</span></code> of type <code class="computeroutput"><span class="keyword">int</span></code>.
|
||||
However, the second macro invocation fails generating a preprocessor error
|
||||
similar to the following:
|
||||
</p><pre class="programlisting">error: macro "VAR" passed 3 arguments, but takes just 2
|
||||
</pre><p>
|
||||
That is because the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span></code> type passed as the first macro parameter
|
||||
contains a comma <code class="computeroutput"><span class="special">,</span></code> not wrapped
|
||||
by round parenthesis <code class="computeroutput"><span class="special">()</span></code>. The preprocessor
|
||||
interprets that unwrapped comma as a separation between macro parameters concluding
|
||||
that a total of three (and not two) parameters are passed to the macro in the
|
||||
following order:
|
||||
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span></code>
|
||||
</li><li class="listitem">
|
||||
<code class="computeroutput"><span class="keyword">char</span><span class="special">></span></code>
|
||||
</li><li class="listitem">
|
||||
<code class="computeroutput"><span class="number">2</span></code>
|
||||
</li></ol></div><p>
|
||||
Note that, differently from the compiler, the preprocessor only recognizes
|
||||
round parameters <code class="computeroutput"><span class="special">()</span></code>. Angular
|
||||
<code class="computeroutput"><span class="special"><></span></code> or squared <code class="computeroutput"><span class="special">[]</span></code> parenthesis are not used by the preprocessor
|
||||
when parsing the macro parameters.
|
||||
</p></div><div class="section boost_utility_identitytype_solution" title="Solution"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.solution"></a><a class="link" href="#boost_utility_identitytype.solution" title="Solution">Solution</a></h2></div></div></div><p>
|
||||
In some cases, it might be possible to workaround this issue by avoiding to
|
||||
pass the type expression to the macro all together. For example, in some cases
|
||||
a <code class="computeroutput"><span class="keyword">typedef</span></code> can be used to specify
|
||||
the type expression with the commas outside the macro (see also <a href="../../test/var.cpp" target="_top"><code class="literal">var.cpp</code></a>):
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
<span class="identifier">VAR</span><span class="special">(</span><span class="identifier">map_type</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// OK.</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
When this is not possible or desired (e.g., see the function template <code class="computeroutput"><span class="identifier">f</span></code> in the section below), the library header
|
||||
<code class="computeroutput"><a class="link" href="#header.boost.utility.identity_type_hpp" title="Header <boost/utility/identity_type.hpp>">boost/utility/identity_type.hpp</a></code>
|
||||
defines a macro <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
which can be used to workaround the issue while keeping the type expression
|
||||
as one of the macro parameters (see also <a href="../../test/var.cpp" target="_top"><code class="literal">var.cpp</code></a>).
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">identity_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
|
||||
<span class="identifier">VAR</span><span class="special">(</span><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">>)),</span> <span class="number">4</span><span class="special">);</span> <span class="comment">// OK.</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
This macro expands to an expression that evaluates (at compile-time) to the
|
||||
specified type. The specified type is never split into multiple macro parameters
|
||||
because it is always wrapped by a set of extra round parenthesis <code class="computeroutput"><span class="special">()</span></code>. In fact, a total of two sets of round parenthesis
|
||||
must be used: The parenthesis to invoke the macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(...)</span></code> plus the inner parenthesis to wrap the
|
||||
type passed to the macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((...))</span></code>.
|
||||
</p><p>
|
||||
This macro works on any <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/standards" target="_top">C++03</a>
|
||||
compiler (because it does not use <a href="http://en.wikipedia.org/wiki/Variadic_macro" target="_top">variadic
|
||||
macros</a>). <sup>[<a name="boost_utility_identitytype.solution.f0" href="#ftn.boost_utility_identitytype.solution.f0" class="footnote">1</a>]</sup>
|
||||
</p></div><div class="section boost_utility_identitytype_templates" title="Templates"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.templates"></a><a class="link" href="#boost_utility_identitytype.templates" title="Templates">Templates</a></h2></div></div></div><p>
|
||||
This macro must be prefixed by <code class="computeroutput"><span class="keyword">typename</span></code>
|
||||
when used within templates. For example, let's program a macro that declares
|
||||
a function parameter named <code class="computeroutput"><span class="identifier">arg</span></code><code class="literal"><span class="emphasis"><em>n</em></span></code>
|
||||
with the specified <code class="literal"><span class="emphasis"><em>type</em></span></code> (see also
|
||||
<a href="../../test/template.cpp" target="_top"><code class="literal">template.cpp</code></a>):
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">ARG</span><span class="special">(</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">n</span><span class="special">)</span> <span class="identifier">type</span> <span class="identifier">arg</span> <span class="error">#</span><span class="preprocessor"># n</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span> <span class="comment">// Prefix macro with `typename` in templates.</span>
|
||||
<span class="identifier">ARG</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>)),</span> <span class="number">1</span><span class="special">)</span>
|
||||
<span class="special">)</span> <span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">arg1</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="identifier">a</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="char">'a'</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">f</span><span class="special"><</span><span class="keyword">char</span><span class="special">>(</span><span class="identifier">a</span><span class="special">);</span> <span class="comment">// OK...</span>
|
||||
<span class="comment">// f(a); // ... but error.</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
However, note that the template parameter <code class="computeroutput"><span class="keyword">char</span></code>
|
||||
must be manually specified when invoking the function <code class="computeroutput"><span class="identifier">f</span><span class="special"><</span><span class="keyword">char</span><span class="special">>(</span><span class="identifier">a</span><span class="special">)</span></code>. In fact,
|
||||
when the <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
macro is used to wrap a function template parameter, the template parameter
|
||||
can no longer be automatically deduced by the compiler form the function call
|
||||
as in <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span></code>. <sup>[<a name="boost_utility_identitytype.templates.f0" href="#ftn.boost_utility_identitytype.templates.f0" class="footnote">2</a>]</sup> (This limitation does not apply to class templates because class
|
||||
template parameters must always be explicitly specified.) In other words, without
|
||||
using the <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
macro, C++ would normally be able to automatically deduce the function template
|
||||
parameter as shown below:
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span> <span class="identifier">arg1</span>
|
||||
<span class="special">)</span> <span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">arg1</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="identifier">g</span><span class="special"><</span><span class="keyword">char</span><span class="special">>(</span><span class="identifier">a</span><span class="special">);</span> <span class="comment">// OK...</span>
|
||||
<span class="identifier">g</span><span class="special">(</span><span class="identifier">a</span><span class="special">);</span> <span class="comment">// ... and also OK.</span>
|
||||
</pre><p>
|
||||
</p></div><div class="section boost_utility_identitytype_abstract_types" title="Abstract Types"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.abstract_types"></a><a class="link" href="#boost_utility_identitytype.abstract_types" title="Abstract Types">Abstract Types</a></h2></div></div></div><p>
|
||||
On some compilers (e.g., GCC), using this macro on abstract types (i.e., classes
|
||||
with one or more pure virtual functions) generates a compiler error. This can
|
||||
be worked around by manipulating the type adding and removing a reference to
|
||||
it.
|
||||
</p><p>
|
||||
Let's program a macro that performs a static assertion on a <a href="http://en.wikipedia.org/wiki/Template_metaprogramming" target="_top">Template
|
||||
Meta-Programming</a> (TMP) meta-function (similarly to Boost.MPL <a href="http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html" target="_top"><code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code></a>). The <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro can be used
|
||||
to pass a meta-function with multiple template parameters to the assert macro
|
||||
(so to handle the commas separating the template parameters). In this case,
|
||||
if the meta-function is an abstract type, it needs to be manipulated adding
|
||||
and removing a reference to it (see also <a href="../../test/tmp_assert.cpp" target="_top"><code class="literal">tmp_assert.cpp</code></a>):
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">TMP_ASSERT</span><span class="special">(</span><span class="identifier">metafunction</span><span class="special">)</span> <span class="special">\</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">metafunction</span><span class="special">::</span><span class="identifier">value</span><span class="special">)</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">abstract</span> <span class="special">{</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
<span class="keyword">virtual</span> <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="comment">// Pure virtual function.</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="identifier">TMP_ASSERT</span><span class="special">(</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span> <span class="comment">// Add and remove</span>
|
||||
<span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span> <span class="comment">// reference for</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_reference</span><span class="special"><</span> <span class="comment">// abstract type.</span>
|
||||
<span class="identifier">abstract</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">true</span><span class="special">></span>
|
||||
<span class="special">>::</span><span class="identifier">type</span>
|
||||
<span class="special">))</span>
|
||||
<span class="special">>::</span><span class="identifier">type</span>
|
||||
<span class="special">);</span>
|
||||
</pre><p>
|
||||
</p></div><div class="section boost_utility_identitytype_annex__usage" title="Annex: Usage"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.annex__usage"></a><a class="link" href="#boost_utility_identitytype.annex__usage" title="Annex: Usage">Annex: Usage</a></h2></div></div></div><p>
|
||||
The <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro
|
||||
can be used either when calling a user-defined macro (as shown by the examples
|
||||
so far), or internally in the definition of a user-defined macro (as shown
|
||||
below). When <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
is used in the user macro definition, the call of the user macro will only
|
||||
have to specify the extra parenthesis (see also <a href="../../test/tmp_assert.cpp" target="_top"><code class="literal">tmp_assert.cpp</code></a>):
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">TMP_ASSERT_PAREN</span><span class="special">(</span><span class="identifier">parenthesized_metafunction</span><span class="special">)</span> <span class="special">\</span>
|
||||
<span class="comment">/* use `BOOST_IDENTITY_TYPE` in macro definition instead of invocation */</span> <span class="special">\</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span><span class="identifier">parenthesized_metafunction</span><span class="special">)::</span><span class="identifier">value</span><span class="special">)</span>
|
||||
|
||||
<span class="comment">// Specify only extra parenthesis `((...))`.</span>
|
||||
<span class="identifier">TMP_ASSERT_PAREN</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="keyword">const</span><span class="special">>));</span>
|
||||
<span class="comment">// Specify both the extra parenthesis `((...))` and `BOOST_IDENTITY_TYPE` macro.</span>
|
||||
<span class="identifier">TMP_ASSERT</span><span class="special">(</span><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="keyword">const</span><span class="special">>)));</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
However, note that the user will <span class="emphasis"><em>always</em></span> have to specify
|
||||
the extra parenthesis even when the macro parameters contain no comma:
|
||||
</p><p>
|
||||
</p><pre class="programlisting"><span class="identifier">TMP_ASSERT_PAREN</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">>));</span> <span class="comment">// Always extra `((...))`.</span>
|
||||
<span class="identifier">TMP_ASSERT</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">>);</span> <span class="comment">// No extra `((...))` and no macro.</span>
|
||||
</pre><p>
|
||||
</p><p>
|
||||
In some cases, using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
within the user macro definition might provide the best syntax for the user.
|
||||
For example, this is the case for <code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code>
|
||||
because the majority of template meta-programming expressions contain unwrapped
|
||||
commas so it is less confusing for the user to always specify the extra parenthesis
|
||||
<code class="computeroutput"><span class="special">((...))</span></code> instead of using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>:
|
||||
</p><pre class="programlisting"><span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="comment">// Natural syntax.</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">and_</span><span class="special"><</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
|
||||
<span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
|
||||
<span class="special">></span>
|
||||
<span class="special">));</span>
|
||||
</pre><p>
|
||||
However, in other situations it might be preferable to not require the extra
|
||||
parenthesis in the common cases and handle commas as special cases using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>. For example, this
|
||||
is the case for <a href="http://www.boost.org/libs/local_function" target="_top"><code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span></code></a> for which always
|
||||
requiring the extra parenthesis <code class="computeroutput"><span class="special">((...))</span></code>
|
||||
around the types would lead to an unnatural syntax for the local function signature:
|
||||
</p><pre class="programlisting"><span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span> <span class="special">((</span><span class="keyword">int</span><span class="special">&))</span> <span class="identifier">x</span><span class="special">,</span> <span class="special">((</span><span class="keyword">int</span><span class="special">&))</span> <span class="identifier">y</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">// Unnatural syntax.</span>
|
||||
<span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
|
||||
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
|
||||
</pre><p>
|
||||
Instead requiring the user to specify <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
only when needed allows for the more natural syntax <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">int</span><span class="special">&</span>
|
||||
<span class="identifier">x</span><span class="special">,</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">y</span><span class="special">)</span></code> in the common cases when the parameter types
|
||||
contain no comma.
|
||||
</p></div><div class="section boost_utility_identitytype_annex__implementation" title="Annex: Implementation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.annex__implementation"></a><a class="link" href="#boost_utility_identitytype.annex__implementation" title="Annex: Implementation">Annex:
|
||||
Implementation</a></h2></div></div></div><p>
|
||||
The implementation of this library macro is equivalent to the following: <sup>[<a name="boost_utility_identitytype.annex__implementation.f0" href="#ftn.boost_utility_identitytype.annex__implementation.f0" class="footnote">3</a>]</sup>
|
||||
</p><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">function_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span><span class="identifier">parenthesized_type</span><span class="special">)</span> <span class="special">\</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span><span class="keyword">void</span> <span class="identifier">parenthesized_type</span><span class="special">>::</span><span class="identifier">arg1_type</span>
|
||||
</pre><p>
|
||||
Essentially, the type is wrapped between round parenthesis <code class="computeroutput"><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span>
|
||||
<span class="keyword">char</span><span class="special">>)</span></code>
|
||||
so it can be passed as a single macro parameter even if it contains commas.
|
||||
Then the parenthesized type is transformed into the type of a function returning
|
||||
<code class="computeroutput"><span class="keyword">void</span></code> and with the specified type
|
||||
as the type of the first and only argument <code class="computeroutput"><span class="keyword">void</span>
|
||||
<span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">>)</span></code>. Finally, the type of the first argument
|
||||
<code class="computeroutput"><span class="identifier">arg1_type</span></code> is extracted at compile-time
|
||||
using the <code class="computeroutput"><span class="identifier">function_traits</span></code> meta-function
|
||||
therefore obtaining the original type from the parenthesized type (effectively
|
||||
stripping the extra parenthesis from around the specified type).
|
||||
</p></div><div class="section reference" title="Reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="reference"></a>Reference</h2></div></div></div><div class="section header_boost_utility_identity_type_hpp" title="Header <boost/utility/identity_type.hpp>"><div class="titlepage"><div><div><h3 class="title"><a name="header.boost.utility.identity_type_hpp"></a>Header <<a href="../../../../../boost/utility/identity_type.hpp" target="_top">boost/utility/identity_type.hpp</a>></h3></div></div></div><p>Wrap type expressions with round parenthesis so they can be passed to macros even if they contain commas. </p><pre class="synopsis">
|
||||
|
||||
<a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a>(parenthesized_type)</pre><div class="refentry" title="Macro BOOST_IDENTITY_TYPE"><a name="BOOST_IDENTITY_TYPE"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">Macro BOOST_IDENTITY_TYPE</span></h2><p>BOOST_IDENTITY_TYPE — This macro allows to wrap the specified type expression within extra round parenthesis so the type can be passed as a single macro parameter even if it contains commas (not already wrapped within round parenthesis). </p></div><h2 class="refsynopsisdiv-title">Synopsis</h2><div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="#header.boost.utility.identity_type_hpp" title="Header <boost/utility/identity_type.hpp>">boost/utility/identity_type.hpp</a>>
|
||||
|
||||
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div><div class="refsect1" title="Description"><a name="id512092"></a><h2>Description</h2><p><span class="bold"><strong>Parameters:</strong></span> </p><div class="informaltable"><table class="table"><colgroup><col><col></colgroup><tbody><tr><td><span class="bold"><strong><code class="computeroutput">parenthesized_type</code></strong></span></td><td>The type expression to be passed as macro parameter wrapped by a single set of round parenthesis <code class="computeroutput">(...)</code>. This type expression can contain an arbitrary number of commas. </td></tr></tbody></table></div><p>
|
||||
</p><p>This macro works on any C++03 compiler (it does not require variadic macros).</p><p>This macro must be prefixed by <code class="computeroutput">typename</code> when used within templates. However, the compiler will not be able to automatically determine function template parameters when they are wrapped with this macro (these parameters need to be explicitly specified when calling the function template).</p><p>On some compilers (like GCC), using this macro on an abstract types requires to add and remove a reference to the type. </p></div></div></div></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a id="ftn.boost_utility_identitytype.solution.f0" href="#boost_utility_identitytype.solution.f0" class="para">1</a>] </sup>
|
||||
Using variadic macros, it would be possible to require a single set of extra
|
||||
parenthesis <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span></code><code class="literal"><span class="emphasis"><em>type</em></span></code><code class="computeroutput"><span class="special">)</span></code> instead of two <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span></code><code class="literal"><span class="emphasis"><em>type</em></span></code><code class="computeroutput"><span class="special">))</span></code> but variadic macros are not part of C++03
|
||||
(even if nowadays they are supported by most modern compilers and they are
|
||||
also part of C++11).
|
||||
</p></div><div class="footnote"><p><sup>[<a id="ftn.boost_utility_identitytype.templates.f0" href="#boost_utility_identitytype.templates.f0" class="para">2</a>] </sup>
|
||||
This is because the implementation of <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
|
||||
wraps the specified type within a meta-function.
|
||||
</p></div><div class="footnote"><p><sup>[<a id="ftn.boost_utility_identitytype.annex__implementation.f0" href="#boost_utility_identitytype.annex__implementation.f0" class="para">3</a>] </sup>
|
||||
There is absolutely no guarantee that the macro is actually implemented using
|
||||
the code listed in this documentation. This code is for explanatory purposes
|
||||
only.
|
||||
</p></div></div></div></body></html>
|
162
identity_type/doc/identity_type.qbk
Normal file
162
identity_type/doc/identity_type.qbk
Normal file
@ -0,0 +1,162 @@
|
||||
|
||||
[/ Copyright (C) 2009-2012 Lorenzo Caminiti ]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 ]
|
||||
[/ (see accompanying file LICENSE_1_0.txt or a copy at ]
|
||||
[/ http://www.boost.org/LICENSE_1_0.txt) ]
|
||||
[/ Home at http://www.boost.org/libs/utility/identity_type ]
|
||||
|
||||
[library Boost.Utility/IdentityType
|
||||
[quickbook 1.5]
|
||||
[version 1.0.0]
|
||||
[copyright 2009-2012 Lorenzo Caminiti]
|
||||
[purpose wraps types with round parenthesis]
|
||||
[license
|
||||
Distributed under the Boost Software License, Version 1.0
|
||||
(see accompanying file LICENSE_1_0.txt or a copy at
|
||||
[@http://www.boost.org/LICENSE_1_0.txt])
|
||||
]
|
||||
[authors [Caminiti <email>lorcaminiti@gmail.com</email>, Lorenzo]]
|
||||
[category Utilities]
|
||||
]
|
||||
|
||||
This library allows to wrap type expressions within round parenthesis so they can be passed to macros even when they contain commas.
|
||||
|
||||
[import ../test/var_error.cpp]
|
||||
[import ../test/var.cpp]
|
||||
[import ../test/template.cpp]
|
||||
[import ../test/tmp_assert.cpp]
|
||||
|
||||
[section Motivation]
|
||||
|
||||
Consider the following macro which declares a variable named `var`[^['n]] with the specified [^['type]] (see also [@../../test/var_error.cpp =var_error.cpp=]):
|
||||
|
||||
[var_error]
|
||||
|
||||
The first macro invocation works correctly declaring a variable named `var1` of type `int`.
|
||||
However, the second macro invocation fails generating a preprocessor error similar to the following:
|
||||
|
||||
[pre
|
||||
error: macro "VAR" passed 3 arguments, but takes just 2
|
||||
]
|
||||
|
||||
That is because the `std::map` type passed as the first macro parameter contains a comma `,` not wrapped by round parenthesis `()`.
|
||||
The preprocessor interprets that unwrapped comma as a separation between macro parameters concluding that a total of three (and not two) parameters are passed to the macro in the following order:
|
||||
|
||||
# `std::map<int`
|
||||
# `char>`
|
||||
# `2`
|
||||
|
||||
Note that, differently from the compiler, the preprocessor only recognizes round parameters `()`.
|
||||
Angular `<>` or squared `[]` parenthesis are not used by the preprocessor when parsing the macro parameters.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Solution]
|
||||
|
||||
In some cases, it might be possible to workaround this issue by avoiding to pass the type expression to the macro all together.
|
||||
For example, in some cases a `typedef` can be used to specify the type expression with the commas outside the macro (see also [@../../test/var.cpp =var.cpp=]):
|
||||
|
||||
[var_typedef]
|
||||
|
||||
When this is not possible or desired (e.g., see the function template `f` in the section below), the library header [headerref boost/utility/identity_type.hpp] defines a macro [macroref BOOST_IDENTITY_TYPE] which can be used to workaround the issue while keeping the type expression as one of the macro parameters (see also [@../../test/var.cpp =var.cpp=]).
|
||||
|
||||
[var_ok]
|
||||
|
||||
This macro expands to an expression that evaluates (at compile-time) to the specified type.
|
||||
The specified type is never split into multiple macro parameters because it is always wrapped by a set of extra round parenthesis `()`.
|
||||
In fact, a total of two sets of round parenthesis must be used: The parenthesis to invoke the macro `BOOST_IDENTITY_TYPE(...)` plus the inner parenthesis to wrap the type passed to the macro `BOOST_IDENTITY_TYPE((...))`.
|
||||
|
||||
This macro works on any [@http://www.open-std.org/JTC1/SC22/WG21/docs/standards C++03] compiler (because it does not use [@http://en.wikipedia.org/wiki/Variadic_macro variadic macros]).
|
||||
[footnote
|
||||
Using variadic macros, it would be possible to require a single set of extra parenthesis `BOOST_IDENTITY_TYPE(`[^['type]]`)` instead of two `BOOST_IDENTITY_TYPE((`[^['type]]`))` but variadic macros are not part of C++03 (even if nowadays they are supported by most modern compilers and they are also part of C++11).
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Templates]
|
||||
|
||||
This macro must be prefixed by `typename` when used within templates.
|
||||
For example, let's program a macro that declares a function parameter named `arg`[^['n]] with the specified [^['type]] (see also [@../../test/template.cpp =template.cpp=]):
|
||||
|
||||
[template_f_decl]
|
||||
[template_f_call]
|
||||
|
||||
However, note that the template parameter `char` must be manually specified when invoking the function `f<char>(a)`.
|
||||
In fact, when the [macroref BOOST_IDENTITY_TYPE] macro is used to wrap a function template parameter, the template parameter can no longer be automatically deduced by the compiler form the function call as in `f(a)`.
|
||||
[footnote
|
||||
This is because the implementation of [macroref BOOST_IDENTITY_TYPE] wraps the specified type within a meta-function.
|
||||
]
|
||||
(This limitation does not apply to class templates because class template parameters must always be explicitly specified.)
|
||||
In other words, without using the [macroref BOOST_IDENTITY_TYPE] macro, C++ would normally be able to automatically deduce the function template parameter as shown below:
|
||||
|
||||
[template_g_decl]
|
||||
[template_g_call]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Abstract Types]
|
||||
|
||||
On some compilers (e.g., GCC), using this macro on abstract types (i.e., classes with one or more pure virtual functions) generates a compiler error.
|
||||
This can be worked around by manipulating the type adding and removing a reference to it.
|
||||
|
||||
Let's program a macro that performs a static assertion on a [@http://en.wikipedia.org/wiki/Template_metaprogramming Template Meta-Programming] (TMP) meta-function (similarly to Boost.MPL [@http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html `BOOST_MPL_ASSERT`]).
|
||||
The [macroref BOOST_IDENTITY_TYPE] macro can be used to pass a meta-function with multiple template parameters to the assert macro (so to handle the commas separating the template parameters).
|
||||
In this case, if the meta-function is an abstract type, it needs to be manipulated adding and removing a reference to it (see also [@../../test/tmp_assert.cpp =tmp_assert.cpp=]):
|
||||
|
||||
[tmp_assert_abstract]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Annex: Usage]
|
||||
|
||||
The [macroref BOOST_IDENTITY_TYPE] macro can be used either when calling a user-defined macro (as shown by the examples so far), or internally in the definition of a user-defined macro (as shown below).
|
||||
When [macroref BOOST_IDENTITY_TYPE] is used in the user macro definition, the call of the user macro will only have to specify the extra parenthesis (see also [@../../test/tmp_assert.cpp =tmp_assert.cpp=]):
|
||||
|
||||
[tmp_assert_alternative]
|
||||
|
||||
However, note that the user will /always/ have to specify the extra parenthesis even when the macro parameters contain no comma:
|
||||
|
||||
[tmp_assert_alternative_always]
|
||||
|
||||
In some cases, using [macroref BOOST_IDENTITY_TYPE] within the user macro definition might provide the best syntax for the user.
|
||||
For example, this is the case for `BOOST_MPL_ASSERT` because the majority of template meta-programming expressions contain unwrapped commas so it is less confusing for the user to always specify the extra parenthesis `((...))` instead of using [macroref BOOST_IDENTITY_TYPE]:
|
||||
|
||||
BOOST_MPL_ASSERT(( // Natural syntax.
|
||||
boost::mpl::and_<
|
||||
boost::is_const<T>
|
||||
, boost::is_reference<T>
|
||||
>
|
||||
));
|
||||
|
||||
However, in other situations it might be preferable to not require the extra parenthesis in the common cases and handle commas as special cases using [macroref BOOST_IDENTITY_TYPE].
|
||||
For example, this is the case for [@http://www.boost.org/libs/local_function `BOOST_LOCAL_FUNCTION`] for which always requiring the extra parenthesis `((...))` around the types would lead to an unnatural syntax for the local function signature:
|
||||
|
||||
int BOOST_LOCAL_FUNCTION( ((int&)) x, ((int&)) y ) { // Unnatural syntax.
|
||||
return x + y;
|
||||
} BOOST_LOCAL_FUNCTION_NAME(add)
|
||||
|
||||
Instead requiring the user to specify [macroref BOOST_IDENTITY_TYPE] only when needed allows for the more natural syntax `BOOST_LOCAL_FUNCTION(int& x, int& y)` in the common cases when the parameter types contain no comma.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Annex: Implementation]
|
||||
|
||||
The implementation of this library macro is equivalent to the following:
|
||||
[footnote
|
||||
There is absolutely no guarantee that the macro is actually implemented using the code listed in this documentation.
|
||||
This code is for explanatory purposes only.
|
||||
]
|
||||
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
|
||||
#define BOOST_IDENTITY_TYPE(parenthesized_type) \
|
||||
boost::function_traits<void parenthesized_type>::arg1_type
|
||||
|
||||
Essentially, the type is wrapped between round parenthesis `(std::map<int, char>)` so it can be passed as a single macro parameter even if it contains commas.
|
||||
Then the parenthesized type is transformed into the type of a function returning `void` and with the specified type as the type of the first and only argument `void (std::map<int, char>)`.
|
||||
Finally, the type of the first argument `arg1_type` is extracted at compile-time using the `function_traits` meta-function therefore obtaining the original type from the parenthesized type (effectively stripping the extra parenthesis from around the specified type).
|
||||
|
||||
[endsect]
|
||||
|
||||
[xinclude reference.xml]
|
||||
|
15
identity_type/index.html
Normal file
15
identity_type/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=doc/html/index.html">
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, click this
|
||||
<a href="doc/html/index.html">link</a> <hr>
|
||||
<p><EFBFBD> Copyright Lorenzo Caminiti, 2009-2012</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0 (see
|
||||
accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or a copy at
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||
</body>
|
||||
</html>
|
14
identity_type/test/Jamfile.v2
Normal file
14
identity_type/test/Jamfile.v2
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
# Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0
|
||||
# (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
# Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
import testing ;
|
||||
|
||||
compile-fail var_error.cpp ;
|
||||
run var.cpp ;
|
||||
run template.cpp ;
|
||||
run tmp_assert.cpp ;
|
||||
|
48
identity_type/test/template.cpp
Normal file
48
identity_type/test/template.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
#include <boost/utility/identity_type.hpp>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
//[template_f_decl
|
||||
#define ARG(type, n) type arg ## n
|
||||
|
||||
template<typename T>
|
||||
void f( // Prefix macro with `typename` in templates.
|
||||
ARG(typename BOOST_IDENTITY_TYPE((std::map<int, T>)), 1)
|
||||
) {
|
||||
std::cout << arg1[0] << std::endl;
|
||||
}
|
||||
//]
|
||||
|
||||
//[template_g_decl
|
||||
template<typename T>
|
||||
void g(
|
||||
std::map<int, T> arg1
|
||||
) {
|
||||
std::cout << arg1[0] << std::endl;
|
||||
}
|
||||
//]
|
||||
|
||||
int main() {
|
||||
//[template_f_call
|
||||
std::map<int, char> a;
|
||||
a[0] = 'a';
|
||||
|
||||
f<char>(a); // OK...
|
||||
// f(a); // ... but error.
|
||||
//]
|
||||
|
||||
//[template_g_call
|
||||
g<char>(a); // OK...
|
||||
g(a); // ... and also OK.
|
||||
//]
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
53
identity_type/test/tmp_assert.cpp
Normal file
53
identity_type/test/tmp_assert.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
#include <boost/utility/identity_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <map>
|
||||
|
||||
//[tmp_assert_abstract
|
||||
#define TMP_ASSERT(metafunction) \
|
||||
BOOST_STATIC_ASSERT(metafunction::value)
|
||||
|
||||
template<typename T, bool b>
|
||||
struct abstract {
|
||||
static const bool value = b;
|
||||
virtual void f(T const& x) = 0; // Pure virtual function.
|
||||
};
|
||||
|
||||
TMP_ASSERT(
|
||||
boost::remove_reference< // Add and remove
|
||||
BOOST_IDENTITY_TYPE(( // reference for
|
||||
boost::add_reference< // abstract type.
|
||||
abstract<int, true>
|
||||
>::type
|
||||
))
|
||||
>::type
|
||||
);
|
||||
//]
|
||||
|
||||
//[tmp_assert_alternative
|
||||
#define TMP_ASSERT_PAREN(parenthesized_metafunction) \
|
||||
/* use `BOOST_IDENTITY_TYPE` in macro definition instead of invocation */ \
|
||||
BOOST_STATIC_ASSERT(BOOST_IDENTITY_TYPE(parenthesized_metafunction)::value)
|
||||
|
||||
// Specify only extra parenthesis `((...))`.
|
||||
TMP_ASSERT_PAREN((boost::is_const<std::map<int, char> const>));
|
||||
// Specify both the extra parenthesis `((...))` and `BOOST_IDENTITY_TYPE` macro.
|
||||
TMP_ASSERT(BOOST_IDENTITY_TYPE((boost::is_const<std::map<int, char> const>)));
|
||||
//]
|
||||
|
||||
//[tmp_assert_alternative_always
|
||||
TMP_ASSERT_PAREN((boost::is_const<int const>)); // Always extra `((...))`.
|
||||
TMP_ASSERT(boost::is_const<int const>); // No extra `((...))` and no macro.
|
||||
//]
|
||||
|
||||
int main() { return 0; }
|
||||
|
26
identity_type/test/var.cpp
Normal file
26
identity_type/test/var.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
#include <map>
|
||||
|
||||
#define VAR(type, n) type var ## n
|
||||
|
||||
VAR(int, 1); // OK.
|
||||
|
||||
//[var_typedef
|
||||
typedef std::map<int, char> map_type;
|
||||
VAR(map_type, 3); // OK.
|
||||
//]
|
||||
|
||||
//[var_ok
|
||||
#include <boost/utility/identity_type.hpp>
|
||||
|
||||
VAR(BOOST_IDENTITY_TYPE((std::map<int, char>)), 4); // OK.
|
||||
//]
|
||||
|
||||
int main() { return 0; }
|
||||
|
18
identity_type/test/var_error.cpp
Normal file
18
identity_type/test/var_error.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
#include <map>
|
||||
|
||||
//[var_error
|
||||
#define VAR(type, n) type var ## n
|
||||
|
||||
VAR(int, 1); // OK.
|
||||
VAR(std::map<int, char>, 2); // Error.
|
||||
//]
|
||||
|
||||
int main() { return 0; }
|
||||
|
@ -99,7 +99,7 @@ directly to the container:</p>
|
||||
<H2><A NAME="framework"></A>Framework</H2>
|
||||
<p>
|
||||
This library proposes a framework to allow some containers to directly contruct contained objects in-place without requiring
|
||||
the entire set of constructor overloads ftom the contained type. It also allows the container to remove the CopyConstuctible
|
||||
the entire set of constructor overloads from the contained type. It also allows the container to remove the CopyConstuctible
|
||||
requirement from the contained type since objects can be directly constructed in-place without need of a copy.<br>
|
||||
The only requirement on the container is that it must provide proper storage (that is, correctly aligned and sized).
|
||||
Naturally, the container will typically support uninitialized storage to avoid the in-place construction to override
|
||||
@ -117,7 +117,7 @@ The following simplified example shows the basic idea. A complete example follow
|
||||
<pre>struct C
|
||||
{
|
||||
template<class InPlaceFactory>
|
||||
C ( InPlaceFactory const& aFactoty )
|
||||
C ( InPlaceFactory const& aFactory )
|
||||
:
|
||||
contained_ ( uninitialized_storage() )
|
||||
{
|
||||
@ -293,4 +293,4 @@ the latest version of this file can be found at <A
|
||||
HREF="http://www.boost.org">www.boost.org</A>, and the boost
|
||||
<A HREF="http://www.boost.org/more/mailing_lists.htm#main">discussion lists</A></P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</HTML>
|
||||
|
@ -1,7 +1,11 @@
|
||||
//
|
||||
// boost/assert.hpp - BOOST_ASSERT(expr)
|
||||
// BOOST_ASSERT_MSG(expr, msg)
|
||||
// BOOST_VERIFY(expr)
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2007 Peter Dimov
|
||||
// Copyright (c) Beman Dawes 2011
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -12,6 +16,16 @@
|
||||
// See http://www.boost.org/libs/utility/assert.html for documentation.
|
||||
//
|
||||
|
||||
//
|
||||
// Stop inspect complaining about use of 'assert':
|
||||
//
|
||||
// boostinspect:naassert_macro
|
||||
//
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_ASSERT //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#undef BOOST_ASSERT
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS)
|
||||
@ -24,14 +38,99 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
|
||||
|
||||
void assertion_failed(char const * expr,
|
||||
char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#define BOOST_ASSERT(expr) ((expr) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
|
||||
# define BOOST_ASSERT(expr) assert(expr)
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_ASSERT_MSG //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
# undef BOOST_ASSERT_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG)
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
||||
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER)
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void assertion_failed_msg(char const * expr, char const * msg,
|
||||
char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) ((expr) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
#ifndef BOOST_ASSERT_HPP
|
||||
#define BOOST_ASSERT_HPP
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
#ifndef BOOST_ASSERT_MSG_OSTREAM
|
||||
# define BOOST_ASSERT_MSG_OSTREAM std::cerr
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace assertion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
inline void assertion_failed_msg(char const * expr, char const * msg, char const * function,
|
||||
char const * file, long line)
|
||||
{
|
||||
BOOST_ASSERT_MSG_OSTREAM
|
||||
<< "***** Internal Program Error - assertion (" << expr << ") failed in "
|
||||
<< function << ":\n"
|
||||
<< file << '(' << line << "): " << msg << std::endl;
|
||||
#ifdef UNDER_CE
|
||||
// The Windows CE CRT library does not have abort() so use exit(-1) instead.
|
||||
std::exit(-1);
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
}
|
||||
} // detail
|
||||
} // assertion
|
||||
} // detail
|
||||
#endif
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) ((expr) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion::detail::assertion_failed_msg(#expr, msg, \
|
||||
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_VERIFY //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#undef BOOST_VERIFY
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_VERIFY(expr) ((void)(expr))
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@ namespace detail
|
||||
inline void current_function_helper()
|
||||
{
|
||||
|
||||
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
|
||||
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
|
||||
|
||||
# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__
|
||||
|
||||
@ -65,3 +65,4 @@ inline void current_function_helper()
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
@ -43,20 +44,26 @@ struct ct_imp2<T, true>
|
||||
typedef const T param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp, bool b1>
|
||||
template <typename T, bool isp, bool b1, bool b2>
|
||||
struct ct_imp
|
||||
{
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp>
|
||||
struct ct_imp<T, isp, true>
|
||||
template <typename T, bool isp, bool b2>
|
||||
struct ct_imp<T, isp, true, b2>
|
||||
{
|
||||
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1>
|
||||
struct ct_imp<T, true, b1>
|
||||
template <typename T, bool isp, bool b1>
|
||||
struct ct_imp<T, isp, b1, true>
|
||||
{
|
||||
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1, bool b2>
|
||||
struct ct_imp<T, true, b1, b2>
|
||||
{
|
||||
typedef const T param_type;
|
||||
};
|
||||
@ -79,7 +86,8 @@ public:
|
||||
typedef typename boost::detail::ct_imp<
|
||||
T,
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_arithmetic<T>::value
|
||||
::boost::is_arithmetic<T>::value,
|
||||
::boost::is_enum<T>::value
|
||||
>::param_type param_type;
|
||||
};
|
||||
|
||||
@ -92,7 +100,7 @@ struct call_traits<T&>
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 ) )
|
||||
#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 )
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
|
11
include/boost/exception.hpp
Normal file
11
include/boost/exception.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||
|
||||
#error The header <boost/exception.hpp> has been deprecated. Please #include <boost/exception/all.hpp> instead.
|
||||
|
||||
#endif
|
@ -8,6 +8,11 @@
|
||||
// See http://www.boost.org/libs/utility/operators.htm for documentation.
|
||||
|
||||
// Revision History
|
||||
// 16 Dec 10 Limit warning suppression for 4284 to older versions of VC++
|
||||
// (Matthew Bradbury, fixes #4432)
|
||||
// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey)
|
||||
// 03 Apr 08 Make sure "convertible to bool" is sufficient
|
||||
// for T::operator<, etc. (Daniel Frey)
|
||||
// 24 May 07 Changed empty_base to depend on T, see
|
||||
// http://svn.boost.org/trac/boost/ticket/979
|
||||
// 21 Oct 02 Modified implementation of operators to allow compilers with a
|
||||
@ -85,7 +90,7 @@
|
||||
# pragma set woff 1234
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1600)
|
||||
# pragma warning( disable : 4284 ) // complaint about return type of
|
||||
#endif // operator-> not begin a UDT
|
||||
|
||||
@ -124,34 +129,34 @@ namespace boost
|
||||
template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
struct less_than_comparable2 : B
|
||||
{
|
||||
friend bool operator<=(const T& x, const U& y) { return !(x > y); }
|
||||
friend bool operator>=(const T& x, const U& y) { return !(x < y); }
|
||||
friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); }
|
||||
friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); }
|
||||
friend bool operator>(const U& x, const T& y) { return y < x; }
|
||||
friend bool operator<(const U& x, const T& y) { return y > x; }
|
||||
friend bool operator<=(const U& x, const T& y) { return !(y < x); }
|
||||
friend bool operator>=(const U& x, const T& y) { return !(y > x); }
|
||||
friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); }
|
||||
friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); }
|
||||
};
|
||||
|
||||
template <class T, class B = ::boost::detail::empty_base<T> >
|
||||
struct less_than_comparable1 : B
|
||||
{
|
||||
friend bool operator>(const T& x, const T& y) { return y < x; }
|
||||
friend bool operator<=(const T& x, const T& y) { return !(y < x); }
|
||||
friend bool operator>=(const T& x, const T& y) { return !(x < y); }
|
||||
friend bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); }
|
||||
friend bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); }
|
||||
};
|
||||
|
||||
template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
struct equality_comparable2 : B
|
||||
{
|
||||
friend bool operator==(const U& y, const T& x) { return x == y; }
|
||||
friend bool operator!=(const U& y, const T& x) { return !(x == y); }
|
||||
friend bool operator!=(const T& y, const U& x) { return !(y == x); }
|
||||
friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); }
|
||||
friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); }
|
||||
};
|
||||
|
||||
template <class T, class B = ::boost::detail::empty_base<T> >
|
||||
struct equality_comparable1 : B
|
||||
{
|
||||
friend bool operator!=(const T& x, const T& y) { return !(x == y); }
|
||||
friend bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); }
|
||||
};
|
||||
|
||||
// A macro which produces "name_2left" from "name".
|
||||
@ -356,7 +361,7 @@ struct equivalent2 : B
|
||||
{
|
||||
friend bool operator==(const T& x, const U& y)
|
||||
{
|
||||
return !(x < y) && !(x > y);
|
||||
return !static_cast<bool>(x < y) && !static_cast<bool>(x > y);
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,7 +370,7 @@ struct equivalent1 : B
|
||||
{
|
||||
friend bool operator==(const T&x, const T&y)
|
||||
{
|
||||
return !(x < y) && !(y < x);
|
||||
return !static_cast<bool>(x < y) && !static_cast<bool>(y < x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -373,17 +378,17 @@ template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
struct partially_ordered2 : B
|
||||
{
|
||||
friend bool operator<=(const T& x, const U& y)
|
||||
{ return (x < y) || (x == y); }
|
||||
{ return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
|
||||
friend bool operator>=(const T& x, const U& y)
|
||||
{ return (x > y) || (x == y); }
|
||||
{ return static_cast<bool>(x > y) || static_cast<bool>(x == y); }
|
||||
friend bool operator>(const U& x, const T& y)
|
||||
{ return y < x; }
|
||||
friend bool operator<(const U& x, const T& y)
|
||||
{ return y > x; }
|
||||
friend bool operator<=(const U& x, const T& y)
|
||||
{ return (y > x) || (y == x); }
|
||||
{ return static_cast<bool>(y > x) || static_cast<bool>(y == x); }
|
||||
friend bool operator>=(const U& x, const T& y)
|
||||
{ return (y < x) || (y == x); }
|
||||
{ return static_cast<bool>(y < x) || static_cast<bool>(y == x); }
|
||||
};
|
||||
|
||||
template <class T, class B = ::boost::detail::empty_base<T> >
|
||||
@ -392,9 +397,9 @@ struct partially_ordered1 : B
|
||||
friend bool operator>(const T& x, const T& y)
|
||||
{ return y < x; }
|
||||
friend bool operator<=(const T& x, const T& y)
|
||||
{ return (x < y) || (x == y); }
|
||||
{ return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
|
||||
friend bool operator>=(const T& x, const T& y)
|
||||
{ return (y < x) || (x == y); }
|
||||
{ return static_cast<bool>(y < x) || static_cast<bool>(x == y); }
|
||||
};
|
||||
|
||||
// Combined operator classes (contributed by Daryle Walker) ----------------//
|
||||
@ -580,7 +585,35 @@ struct ordered_euclidian_ring_operators1
|
||||
: totally_ordered1<T
|
||||
, euclidian_ring_operators1<T, B
|
||||
> > {};
|
||||
|
||||
|
||||
template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
struct euclidean_ring_operators2
|
||||
: ring_operators2<T, U
|
||||
, dividable2<T, U
|
||||
, dividable2_left<T, U
|
||||
, modable2<T, U
|
||||
, modable2_left<T, U, B
|
||||
> > > > > {};
|
||||
|
||||
template <class T, class B = ::boost::detail::empty_base<T> >
|
||||
struct euclidean_ring_operators1
|
||||
: ring_operators1<T
|
||||
, dividable1<T
|
||||
, modable1<T, B
|
||||
> > > {};
|
||||
|
||||
template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
struct ordered_euclidean_ring_operators2
|
||||
: totally_ordered2<T, U
|
||||
, euclidean_ring_operators2<T, U, B
|
||||
> > {};
|
||||
|
||||
template <class T, class B = ::boost::detail::empty_base<T> >
|
||||
struct ordered_euclidean_ring_operators1
|
||||
: totally_ordered1<T
|
||||
, euclidean_ring_operators1<T, B
|
||||
> > {};
|
||||
|
||||
template <class T, class P, class B = ::boost::detail::empty_base<T> >
|
||||
struct input_iteratable
|
||||
: equality_comparable1<T
|
||||
@ -837,6 +870,8 @@ BOOST_OPERATOR_TEMPLATE(field_operators)
|
||||
BOOST_OPERATOR_TEMPLATE(ordered_field_operators)
|
||||
BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators)
|
||||
BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators)
|
||||
BOOST_OPERATOR_TEMPLATE(euclidean_ring_operators)
|
||||
BOOST_OPERATOR_TEMPLATE(ordered_euclidean_ring_operators)
|
||||
BOOST_OPERATOR_TEMPLATE2(input_iteratable)
|
||||
BOOST_OPERATOR_TEMPLATE1(output_iteratable)
|
||||
BOOST_OPERATOR_TEMPLATE2(forward_iteratable)
|
||||
|
@ -15,7 +15,7 @@
|
||||
//
|
||||
// ref.hpp - ref/cref, useful helper functions
|
||||
//
|
||||
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
|
||||
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
||||
// Copyright (C) 2001, 2002 Peter Dimov
|
||||
// Copyright (C) 2002 David Abrahams
|
||||
//
|
||||
@ -173,6 +173,17 @@ class unwrap_reference
|
||||
|
||||
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template <class T> inline typename unwrap_reference<T>::type&
|
||||
unwrap_ref(T& t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
template<class T> inline T* get_pointer( reference_wrapper<T> const & r )
|
||||
{
|
||||
return r.get_pointer();
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_REF_HPP_INCLUDED
|
||||
|
12
include/boost/swap.hpp
Normal file
12
include/boost/swap.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_SWAP_HPP
|
||||
#define BOOST_SWAP_HPP
|
||||
|
||||
#include "boost/utility/swap.hpp"
|
||||
|
||||
#endif
|
@ -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>
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
||||
// Douglas Gregor (gregod@cs.rpi.edu)
|
||||
// Peter Dimov
|
||||
//
|
||||
// Copyright (C) 2002, 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -14,32 +15,75 @@
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// VC7 strips const from nested classes unless we add indirection here
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
template<class T> struct addr_impl_ref
|
||||
{
|
||||
T & v_;
|
||||
|
||||
template<class T> struct _addp
|
||||
inline addr_impl_ref( T & v ): v_( v ) {}
|
||||
inline operator T& () const { return v_; }
|
||||
|
||||
private:
|
||||
addr_impl_ref & operator=(const addr_impl_ref &);
|
||||
};
|
||||
|
||||
template<class T> struct addressof_impl
|
||||
{
|
||||
static inline T * f( T & v, long )
|
||||
{
|
||||
return reinterpret_cast<T*>(
|
||||
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
||||
}
|
||||
|
||||
static inline T * f( T * v, int )
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T> T * addressof( T & v )
|
||||
{
|
||||
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) )
|
||||
|
||||
return boost::detail::addressof_impl<T>::f( v, 0 );
|
||||
|
||||
#else
|
||||
|
||||
return boost::detail::addressof_impl<T>::f( boost::detail::addr_impl_ref<T>( v ), 0 );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) )
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class T> struct addressof_addp
|
||||
{
|
||||
typedef T * type;
|
||||
};
|
||||
|
||||
template <typename T> typename _addp<T>::type
|
||||
|
||||
# else
|
||||
template <typename T> T*
|
||||
# endif
|
||||
addressof(T& v)
|
||||
} // namespace detail
|
||||
|
||||
template< class T, std::size_t N >
|
||||
typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] )
|
||||
{
|
||||
return reinterpret_cast<T*>(
|
||||
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
||||
return &t;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Borland doesn't like casting an array reference to a char reference
|
||||
// but these overloads work around the problem.
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template<typename T,std::size_t N>
|
||||
T (*addressof(T (&t)[N]))[N]
|
||||
{
|
||||
@ -51,8 +95,8 @@ const T (*addressof(const T (&t)[N]))[N]
|
||||
{
|
||||
return reinterpret_cast<const T(*)[N]>(&t);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UTILITY_ADDRESSOF_HPP
|
||||
|
@ -1,6 +1,6 @@
|
||||
// boost utility/base_from_member.hpp header file --------------------------//
|
||||
|
||||
// Copyright 2001, 2003, 2004 Daryle Walker. Use, modification, and
|
||||
// Copyright 2001, 2003, 2004, 2012 Daryle Walker. Use, modification, and
|
||||
// distribution are subject to the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or a copy at
|
||||
// <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||
@ -10,10 +10,15 @@
|
||||
#ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP
|
||||
#define BOOST_UTILITY_BASE_FROM_MEMBER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
|
||||
// Base-from-member arity configuration macro ------------------------------//
|
||||
@ -53,6 +58,59 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Type-unmarking class template -------------------------------------------//
|
||||
|
||||
// Type-trait to get the raw type, i.e. the type without top-level reference nor
|
||||
// cv-qualification, from a type expression. Mainly for function arguments, any
|
||||
// reference part is stripped first.
|
||||
|
||||
// Contributed by Daryle Walker
|
||||
|
||||
template < typename T >
|
||||
struct remove_cv_ref
|
||||
{
|
||||
typedef typename ::boost::remove_cv<typename
|
||||
::boost::remove_reference<T>::type>::type type;
|
||||
|
||||
}; // boost::detail::remove_cv_ref
|
||||
|
||||
// Unmarked-type comparison class template ---------------------------------//
|
||||
|
||||
// Type-trait to check if two type expressions have the same raw type.
|
||||
|
||||
// Contributed by Daryle Walker, based on a work-around by Luc Danton
|
||||
|
||||
template < typename T, typename U >
|
||||
struct is_related
|
||||
: public ::boost::is_same<
|
||||
typename ::boost::detail::remove_cv_ref<T>::type,
|
||||
typename ::boost::detail::remove_cv_ref<U>::type >
|
||||
{};
|
||||
|
||||
// Enable-if-on-unidentical-unmarked-type class template -------------------//
|
||||
|
||||
// Enable-if on the first two type expressions NOT having the same raw type.
|
||||
|
||||
// Contributed by Daryle Walker, based on a work-around by Luc Danton
|
||||
|
||||
#ifndef BOOST_NO_VARIADIC_TEMPLATES
|
||||
template<typename ...T>
|
||||
struct enable_if_unrelated
|
||||
: public ::boost::enable_if_c<true>
|
||||
{};
|
||||
|
||||
template<typename T, typename U, typename ...U2>
|
||||
struct enable_if_unrelated<T, U, U2...>
|
||||
: public ::boost::disable_if< ::boost::detail::is_related<T, U> >
|
||||
{};
|
||||
#endif
|
||||
|
||||
} // namespace boost::detail
|
||||
|
||||
|
||||
// Base-from-member class template -----------------------------------------//
|
||||
|
||||
// Helper to initialize a base object so a derived class can use this
|
||||
@ -68,12 +126,24 @@ class base_from_member
|
||||
protected:
|
||||
MemberType member;
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_VARIADIC_TEMPLATES) && \
|
||||
!defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
|
||||
template <typename ...T, typename EnableIf = typename
|
||||
::boost::detail::enable_if_unrelated<base_from_member, T...>::type>
|
||||
explicit BOOST_CONSTEXPR base_from_member( T&& ...x )
|
||||
BOOST_NOEXCEPT_IF( BOOST_NOEXCEPT_EXPR(::new ((void*) 0) MemberType(
|
||||
static_cast<T&&>(x)... )) ) // no std::is_nothrow_constructible...
|
||||
: member( static_cast<T&&>(x)... ) // ...nor std::forward needed
|
||||
{}
|
||||
#else
|
||||
base_from_member()
|
||||
: member()
|
||||
{}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_BASE_FROM_MEMBER_MAX_ARITY),
|
||||
BOOST_PRIVATE_CTR_DEF, _ )
|
||||
#endif
|
||||
|
||||
}; // boost::base_from_member
|
||||
|
||||
|
708
include/boost/utility/binary.hpp
Normal file
708
include/boost/utility/binary.hpp
Normal file
@ -0,0 +1,708 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005 Matthew Calabrese
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_UTILITY_BINARY_HPP
|
||||
#define BOOST_UTILITY_BINARY_HPP
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Binary Literal Utility
|
||||
______________________
|
||||
|
||||
|
||||
The following code works by converting the input bit pattern into a
|
||||
Boost.Preprocessor sequence, then converting groupings of 3 bits each into
|
||||
the corresponding octal digit, and finally concatenating all of the digits
|
||||
together along with a leading zero. This yields a standard octal literal
|
||||
with the desired value as specified in bits.
|
||||
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/preprocessor/control/deduce_d.hpp>
|
||||
#include <boost/preprocessor/facilities/identity.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/seq/cat.hpp>
|
||||
#include <boost/preprocessor/seq/transform.hpp>
|
||||
#include <boost/preprocessor/arithmetic/mod.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/control/while.hpp>
|
||||
|
||||
#define BOOST_BINARY( bit_groupings ) \
|
||||
BOOST_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings )
|
||||
|
||||
#define BOOST_BINARY_U( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, U )
|
||||
|
||||
#define BOOST_BINARY_L( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, L )
|
||||
|
||||
#define BOOST_BINARY_UL( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, UL )
|
||||
|
||||
#define BOOST_BINARY_LU( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LU )
|
||||
|
||||
#define BOOST_BINARY_LL( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LL )
|
||||
|
||||
#define BOOST_BINARY_ULL( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, ULL )
|
||||
|
||||
#define BOOST_BINARY_LLU( bit_groupings ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LLU )
|
||||
|
||||
#define BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, suffix ) \
|
||||
BOOST_SUFFIXED_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings, suffix )
|
||||
|
||||
#define BOOST_SUFFIXED_BINARY_LITERAL_D( d, bit_groupings, suffix ) \
|
||||
BOOST_PP_CAT( BOOST_BINARY_LITERAL_D( d, bit_groupings ), suffix )
|
||||
|
||||
#define BOOST_BINARY_LITERAL_D( d, bit_groupings ) \
|
||||
BOOST_PP_SEQ_CAT \
|
||||
( (0) BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \
|
||||
)
|
||||
|
||||
#define BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \
|
||||
BOOST_PP_SEQ_TRANSFORM \
|
||||
( BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION \
|
||||
, BOOST_PP_NIL \
|
||||
, BOOST_PP_IDENTITY( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE )()\
|
||||
( BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE \
|
||||
( \
|
||||
d \
|
||||
, BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE( bit_sequence ) \
|
||||
BOOST_PP_CAT \
|
||||
( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1 bit_sequence \
|
||||
, END_BIT \
|
||||
)
|
||||
|
||||
#define BOOST_DETAIL_BITS_PER_OCTIT 3
|
||||
|
||||
#define BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE( d, incomplete_nibble_sequence ) \
|
||||
BOOST_PP_CAT \
|
||||
( BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_ \
|
||||
, BOOST_PP_MOD_D( d \
|
||||
, BOOST_PP_SEQ_SIZE( incomplete_nibble_sequence ) \
|
||||
, BOOST_DETAIL_BITS_PER_OCTIT \
|
||||
) \
|
||||
) \
|
||||
incomplete_nibble_sequence
|
||||
|
||||
#define BOOST_DETAIL_FIXED_COMPL( bit ) \
|
||||
BOOST_PP_CAT( BOOST_DETAIL_FIXED_COMPL_, bit )
|
||||
|
||||
#define BOOST_DETAIL_FIXED_COMPL_0 1
|
||||
|
||||
#define BOOST_DETAIL_FIXED_COMPL_1 0
|
||||
|
||||
#define BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \
|
||||
BOOST_PP_EMPTY \
|
||||
BOOST_PP_CAT( BOOST_PP_WHILE_, d ) \
|
||||
( BOOST_DETAIL_BINARY_LITERAL_PREDICATE \
|
||||
, BOOST_DETAIL_BINARY_LITERAL_OPERATION \
|
||||
, bit_groupings () \
|
||||
)
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_PREDICATE( d, state ) \
|
||||
BOOST_DETAIL_FIXED_COMPL( BOOST_DETAIL_IS_NULLARY_ARGS( state ) )
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_OPERATION( d, state ) \
|
||||
BOOST_DETAIL_SPLIT_AND_SWAP \
|
||||
( BOOST_PP_CAT( BOOST_DETAIL_BINARY_LITERAL_ELEMENT_, state ) )
|
||||
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION( s, dummy_param, tuple ) \
|
||||
BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL tuple
|
||||
|
||||
#define BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL( bit2, bit1, bit0 ) \
|
||||
BOOST_DETAIL_TRIPLE_TO_OCTAL_ ## bit2 ## bit1 ## bit0
|
||||
|
||||
#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_1 (0)(0)
|
||||
#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_2 (0)
|
||||
#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_0
|
||||
|
||||
#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1END_BIT
|
||||
|
||||
#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1( bit ) \
|
||||
( ( bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2
|
||||
|
||||
#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2( bit ) \
|
||||
bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3
|
||||
|
||||
#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3( bit ) \
|
||||
bit ) ) BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1
|
||||
|
||||
#define BOOST_DETAIL_SPLIT_AND_SWAP( params ) \
|
||||
BOOST_PP_IDENTITY( BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS )()( params )
|
||||
|
||||
#define BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS( first_param, second_param ) \
|
||||
second_param first_param
|
||||
|
||||
#define BOOST_DETAIL_LEFT_OF_COMMA( params ) \
|
||||
BOOST_PP_IDENTITY( BOOST_DETAIL_FIRST_MACRO_PARAM )()( params )
|
||||
|
||||
#define BOOST_DETAIL_FIRST_MACRO_PARAM( first_param, second_param ) \
|
||||
first_param
|
||||
|
||||
/* Begin derived concepts from Chaos by Paul Mensonides */
|
||||
|
||||
#define BOOST_DETAIL_IS_NULLARY_ARGS( param ) \
|
||||
BOOST_DETAIL_LEFT_OF_COMMA \
|
||||
( BOOST_PP_CAT( BOOST_DETAIL_IS_NULLARY_ARGS_R_ \
|
||||
, BOOST_DETAIL_IS_NULLARY_ARGS_C param \
|
||||
) \
|
||||
)
|
||||
|
||||
#define BOOST_DETAIL_IS_NULLARY_ARGS_C() \
|
||||
1
|
||||
|
||||
#define BOOST_DETAIL_IS_NULLARY_ARGS_R_1 \
|
||||
1, BOOST_PP_NIL
|
||||
|
||||
#define BOOST_DETAIL_IS_NULLARY_ARGS_R_BOOST_DETAIL_IS_NULLARY_ARGS_C \
|
||||
0, BOOST_PP_NIL
|
||||
|
||||
/* End derived concepts from Chaos by Paul Mensonides */
|
||||
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_000 0
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_001 1
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_010 2
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_011 3
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_100 4
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_101 5
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_110 6
|
||||
#define BOOST_DETAIL_TRIPLE_TO_OCTAL_111 7
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0 (0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1 (1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000 (0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001 (0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010 (0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011 (0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100 (1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101 (1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110 (1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111 (1)(1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000 (0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001 (0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010 (0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011 (0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100 (0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101 (0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110 (0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111 (0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000 (1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001 (1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010 (1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011 (1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100 (1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101 (1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110 (1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111 (1)(1)(1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000 (0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001 (0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010 (0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011 (0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100 (0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101 (0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110 (0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111 (0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000 (0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001 (0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010 (0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011 (0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100 (0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101 (0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110 (0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111 (0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000 (1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001 (1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010 (1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011 (1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100 (1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101 (1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110 (1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111 (1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000 (1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001 (1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010 (1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011 (1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100 (1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101 (1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110 (1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111 (1)(1)(1)(1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000000 (0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000001 (0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000010 (0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000011 (0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000100 (0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000101 (0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000110 (0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000111 (0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001000 (0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001001 (0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001010 (0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001011 (0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001100 (0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001101 (0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001110 (0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001111 (0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010000 (0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010001 (0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010010 (0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010011 (0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010100 (0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010101 (0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010110 (0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010111 (0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011000 (0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011001 (0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011010 (0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011011 (0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011100 (0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011101 (0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011110 (0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011111 (0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100000 (1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100001 (1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100010 (1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100011 (1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100100 (1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100101 (1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100110 (1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100111 (1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101000 (1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101001 (1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101010 (1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101011 (1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101100 (1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101101 (1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101110 (1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101111 (1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110000 (1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110001 (1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110010 (1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110011 (1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110100 (1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110101 (1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110110 (1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110111 (1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111000 (1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111001 (1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111010 (1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111011 (1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111100 (1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111101 (1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111110 (1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111111 (1)(1)(1)(1)(1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000000 (0)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000001 (0)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000010 (0)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000011 (0)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000100 (0)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000101 (0)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000110 (0)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000111 (0)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001000 (0)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001001 (0)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001010 (0)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001011 (0)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001100 (0)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001101 (0)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001110 (0)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001111 (0)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010000 (0)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010001 (0)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010010 (0)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010011 (0)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010100 (0)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010101 (0)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010110 (0)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010111 (0)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011000 (0)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011001 (0)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011010 (0)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011011 (0)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011100 (0)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011101 (0)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011110 (0)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011111 (0)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100000 (0)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100001 (0)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100010 (0)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100011 (0)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100100 (0)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100101 (0)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100110 (0)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100111 (0)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101000 (0)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101001 (0)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101010 (0)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101011 (0)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101100 (0)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101101 (0)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101110 (0)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101111 (0)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110000 (0)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110001 (0)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110010 (0)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110011 (0)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110100 (0)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110101 (0)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110110 (0)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110111 (0)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111000 (0)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111001 (0)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111010 (0)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111011 (0)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111100 (0)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111101 (0)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111110 (0)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111111 (0)(1)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000000 (1)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000001 (1)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000010 (1)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000011 (1)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000100 (1)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000101 (1)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000110 (1)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000111 (1)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001000 (1)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001001 (1)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001010 (1)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001011 (1)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001100 (1)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001101 (1)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001110 (1)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001111 (1)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010000 (1)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010001 (1)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010010 (1)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010011 (1)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010100 (1)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010101 (1)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010110 (1)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010111 (1)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011000 (1)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011001 (1)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011010 (1)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011011 (1)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011100 (1)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011101 (1)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011110 (1)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011111 (1)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100000 (1)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100001 (1)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100010 (1)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100011 (1)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100100 (1)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100101 (1)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100110 (1)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100111 (1)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101000 (1)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101001 (1)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101010 (1)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101011 (1)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101100 (1)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101101 (1)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101110 (1)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101111 (1)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110000 (1)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110001 (1)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110010 (1)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110011 (1)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110100 (1)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110101 (1)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110110 (1)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110111 (1)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111000 (1)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111001 (1)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111010 (1)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111011 (1)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111100 (1)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111101 (1)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111110 (1)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111111 (1)(1)(1)(1)(1)(1)(1),
|
||||
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000000 (0)(0)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000001 (0)(0)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000010 (0)(0)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000011 (0)(0)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000100 (0)(0)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000101 (0)(0)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000110 (0)(0)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000111 (0)(0)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001000 (0)(0)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001001 (0)(0)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001010 (0)(0)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001011 (0)(0)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001100 (0)(0)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001101 (0)(0)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001110 (0)(0)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001111 (0)(0)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010000 (0)(0)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010001 (0)(0)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010010 (0)(0)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010011 (0)(0)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010100 (0)(0)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010101 (0)(0)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010110 (0)(0)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010111 (0)(0)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011000 (0)(0)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011001 (0)(0)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011010 (0)(0)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011011 (0)(0)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011100 (0)(0)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011101 (0)(0)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011110 (0)(0)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011111 (0)(0)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100000 (0)(0)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100001 (0)(0)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100010 (0)(0)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100011 (0)(0)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100100 (0)(0)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100101 (0)(0)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100110 (0)(0)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100111 (0)(0)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101000 (0)(0)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101001 (0)(0)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101010 (0)(0)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101011 (0)(0)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101100 (0)(0)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101101 (0)(0)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101110 (0)(0)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101111 (0)(0)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110000 (0)(0)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110001 (0)(0)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110010 (0)(0)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110011 (0)(0)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110100 (0)(0)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110101 (0)(0)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110110 (0)(0)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110111 (0)(0)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111000 (0)(0)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111001 (0)(0)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111010 (0)(0)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111011 (0)(0)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111100 (0)(0)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111101 (0)(0)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111110 (0)(0)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111111 (0)(0)(1)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000000 (0)(1)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000001 (0)(1)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000010 (0)(1)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000011 (0)(1)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000100 (0)(1)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000101 (0)(1)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000110 (0)(1)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000111 (0)(1)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001000 (0)(1)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001001 (0)(1)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001010 (0)(1)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001011 (0)(1)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001100 (0)(1)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001101 (0)(1)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001110 (0)(1)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001111 (0)(1)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010000 (0)(1)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010001 (0)(1)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010010 (0)(1)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010011 (0)(1)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010100 (0)(1)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010101 (0)(1)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010110 (0)(1)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010111 (0)(1)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011000 (0)(1)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011001 (0)(1)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011010 (0)(1)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011011 (0)(1)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011100 (0)(1)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011101 (0)(1)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011110 (0)(1)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011111 (0)(1)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100000 (0)(1)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100001 (0)(1)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100010 (0)(1)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100011 (0)(1)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100100 (0)(1)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100101 (0)(1)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100110 (0)(1)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100111 (0)(1)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101000 (0)(1)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101001 (0)(1)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101010 (0)(1)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101011 (0)(1)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101100 (0)(1)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101101 (0)(1)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101110 (0)(1)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101111 (0)(1)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110000 (0)(1)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110001 (0)(1)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110010 (0)(1)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110011 (0)(1)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110100 (0)(1)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110101 (0)(1)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110110 (0)(1)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110111 (0)(1)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111000 (0)(1)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111001 (0)(1)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111010 (0)(1)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111011 (0)(1)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111100 (0)(1)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111101 (0)(1)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111110 (0)(1)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111111 (0)(1)(1)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000000 (1)(0)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000001 (1)(0)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000010 (1)(0)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000011 (1)(0)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000100 (1)(0)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000101 (1)(0)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000110 (1)(0)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000111 (1)(0)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001000 (1)(0)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001001 (1)(0)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001010 (1)(0)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001011 (1)(0)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001100 (1)(0)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001101 (1)(0)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001110 (1)(0)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001111 (1)(0)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010000 (1)(0)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010001 (1)(0)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010010 (1)(0)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010011 (1)(0)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010100 (1)(0)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010101 (1)(0)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010110 (1)(0)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010111 (1)(0)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011000 (1)(0)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011001 (1)(0)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011010 (1)(0)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011011 (1)(0)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011100 (1)(0)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011101 (1)(0)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011110 (1)(0)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011111 (1)(0)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100000 (1)(0)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100001 (1)(0)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100010 (1)(0)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100011 (1)(0)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100100 (1)(0)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100101 (1)(0)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100110 (1)(0)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100111 (1)(0)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101000 (1)(0)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101001 (1)(0)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101010 (1)(0)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101011 (1)(0)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101100 (1)(0)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101101 (1)(0)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101110 (1)(0)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101111 (1)(0)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110000 (1)(0)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110001 (1)(0)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110010 (1)(0)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110011 (1)(0)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110100 (1)(0)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110101 (1)(0)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110110 (1)(0)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110111 (1)(0)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111000 (1)(0)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111001 (1)(0)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111010 (1)(0)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111011 (1)(0)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111100 (1)(0)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111101 (1)(0)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111110 (1)(0)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111111 (1)(0)(1)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000000 (1)(1)(0)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000001 (1)(1)(0)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000010 (1)(1)(0)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000011 (1)(1)(0)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000100 (1)(1)(0)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000101 (1)(1)(0)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000110 (1)(1)(0)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000111 (1)(1)(0)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001000 (1)(1)(0)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001001 (1)(1)(0)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001010 (1)(1)(0)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001011 (1)(1)(0)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001100 (1)(1)(0)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001101 (1)(1)(0)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001110 (1)(1)(0)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001111 (1)(1)(0)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010000 (1)(1)(0)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010001 (1)(1)(0)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010010 (1)(1)(0)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010011 (1)(1)(0)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010100 (1)(1)(0)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010101 (1)(1)(0)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010110 (1)(1)(0)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010111 (1)(1)(0)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011000 (1)(1)(0)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011001 (1)(1)(0)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011010 (1)(1)(0)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011011 (1)(1)(0)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011100 (1)(1)(0)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011101 (1)(1)(0)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011110 (1)(1)(0)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011111 (1)(1)(0)(1)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100000 (1)(1)(1)(0)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100001 (1)(1)(1)(0)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100010 (1)(1)(1)(0)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100011 (1)(1)(1)(0)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100100 (1)(1)(1)(0)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100101 (1)(1)(1)(0)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100110 (1)(1)(1)(0)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100111 (1)(1)(1)(0)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101000 (1)(1)(1)(0)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101001 (1)(1)(1)(0)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101010 (1)(1)(1)(0)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101011 (1)(1)(1)(0)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101100 (1)(1)(1)(0)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101101 (1)(1)(1)(0)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101110 (1)(1)(1)(0)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101111 (1)(1)(1)(0)(1)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110000 (1)(1)(1)(1)(0)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110001 (1)(1)(1)(1)(0)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110010 (1)(1)(1)(1)(0)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110011 (1)(1)(1)(1)(0)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110100 (1)(1)(1)(1)(0)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110101 (1)(1)(1)(1)(0)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110110 (1)(1)(1)(1)(0)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110111 (1)(1)(1)(1)(0)(1)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111000 (1)(1)(1)(1)(1)(0)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111001 (1)(1)(1)(1)(1)(0)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111010 (1)(1)(1)(1)(1)(0)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111011 (1)(1)(1)(1)(1)(0)(1)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111100 (1)(1)(1)(1)(1)(1)(0)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111101 (1)(1)(1)(1)(1)(1)(0)(1),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111110 (1)(1)(1)(1)(1)(1)(1)(0),
|
||||
#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111111 (1)(1)(1)(1)(1)(1)(1)(1),
|
||||
|
||||
#endif
|
@ -4,7 +4,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
|
44
include/boost/utility/declval.hpp
Normal file
44
include/boost/utility/declval.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
// common_type.hpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
|
||||
#define BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <boost/type_traits/add_rvalue_reference.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// C++03 implementation of //
|
||||
// Written by Vicente J. Botet Escriba //
|
||||
//~ 20.3.4 Function template declval [declval]
|
||||
//~ 1 The library provides the function template declval to simplify the definition of expressions which occur as
|
||||
//~ unevaluated operands.
|
||||
//~ 2 Remarks: If this function is used, the program is ill-formed.
|
||||
//~ 3 Remarks: The template parameter T of declval may be an incomplete type.
|
||||
//~ [ Example:
|
||||
|
||||
//~ template <class To, class From>
|
||||
//~ decltype(static_cast<To>(declval<From>())) convert(From&&);
|
||||
|
||||
//~ declares a function template convert which only participats in overloading if the type From can be
|
||||
//~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). <20>end
|
||||
//~ example ]
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
|
@ -5,7 +5,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
|
@ -5,7 +5,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
|
@ -20,10 +20,63 @@
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: boost::detail::result_of_impl<F, F(BOOST_RESULT_OF_ARGS), (boost::detail::has_result_type<F>::value)> {};
|
||||
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: mpl::if_<
|
||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
||||
, boost::detail::tr1_result_of_impl<
|
||||
typename remove_cv<F>::type,
|
||||
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
||||
(boost::detail::has_result_type<F>::value)>
|
||||
, boost::detail::tr1_result_of_impl<
|
||||
F,
|
||||
F(BOOST_RESULT_OF_ARGS),
|
||||
(boost::detail::has_result_type<F>::value)> >::type { };
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_DECLTYPE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||
|
||||
// Uses declval following N3225 20.7.7.6 when F is not a pointer.
|
||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||
: mpl::if_<
|
||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
||||
, detail::tr1_result_of_impl<
|
||||
typename remove_cv<F>::type,
|
||||
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
||||
>
|
||||
, detail::cpp0x_result_of_impl<
|
||||
F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
>
|
||||
>::type
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||
{
|
||||
typedef decltype(
|
||||
boost::declval<F>()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), declval<T, >() BOOST_PP_INTERCEPT)
|
||||
)
|
||||
) type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#else // defined(BOOST_NO_DECLTYPE)
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
|
||||
#endif
|
||||
|
||||
#endif // defined(BOOST_NO_DECLTYPE)
|
||||
|
||||
#undef BOOST_RESULT_OF_ARGS
|
||||
|
||||
#if BOOST_PP_ITERATION() >= 1
|
||||
@ -32,14 +85,14 @@ namespace detail {
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
@ -47,7 +100,7 @@ struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (T0::*)
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
|
||||
FArgs, false>
|
||||
{
|
||||
@ -56,7 +109,7 @@ struct result_of_impl<R (T0::*)
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (T0::*)
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
const,
|
||||
FArgs, false>
|
||||
@ -66,7 +119,7 @@ struct result_of_impl<R (T0::*)
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (T0::*)
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
volatile,
|
||||
FArgs, false>
|
||||
@ -76,7 +129,7 @@ struct result_of_impl<R (T0::*)
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (T0::*)
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
const volatile,
|
||||
FArgs, false>
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Boost enable_if library
|
||||
|
||||
// Copyright 2003 <EFBFBD> The Trustees of Indiana University.
|
||||
// Copyright 2003 (c) The Trustees of Indiana University.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Jaakko J<EFBFBD>rvi (jajarvi at osl.iu.edu)
|
||||
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
|
45
include/boost/utility/identity_type.hpp
Normal file
45
include/boost/utility/identity_type.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/utility/identity_type
|
||||
|
||||
/** @file
|
||||
Wrap type expressions with round parenthesis so they can be passed to macros
|
||||
even if they contain commas.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_IDENTITY_TYPE_HPP_
|
||||
#define BOOST_IDENTITY_TYPE_HPP_
|
||||
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
|
||||
/**
|
||||
@brief This macro allows to wrap the specified type expression within extra
|
||||
round parenthesis so the type can be passed as a single macro parameter even if
|
||||
it contains commas (not already wrapped within round parenthesis).
|
||||
|
||||
@Params
|
||||
@Param{parenthesized_type,
|
||||
The type expression to be passed as macro parameter wrapped by a single set
|
||||
of round parenthesis <c>(...)</c>.
|
||||
This type expression can contain an arbitrary number of commas.
|
||||
}
|
||||
@EndParams
|
||||
|
||||
This macro works on any C++03 compiler (it does not require variadic macros).
|
||||
|
||||
This macro must be prefixed by <c>typename</c> when used within templates.
|
||||
However, the compiler will not be able to automatically determine function template parameters when they are wrapped with this macro (these parameters need to
|
||||
be explicitly specified when calling the function template).
|
||||
|
||||
On some compilers (like GCC), using this macro on an abstract types requires to
|
||||
add and remove a reference to the type.
|
||||
*/
|
||||
#define BOOST_IDENTITY_TYPE(parenthesized_type) \
|
||||
/* must NOT prefix this with `::` to work with parenthesized syntax */ \
|
||||
boost::function_traits< void parenthesized_type >::arg1_type
|
||||
|
||||
#endif // #include guard
|
||||
|
@ -5,7 +5,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
|
@ -10,28 +10,38 @@
|
||||
#define BOOST_RESULT_OF_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#include <boost/type.hpp>
|
||||
#include <boost/preprocessor.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/utility/declval.hpp>
|
||||
|
||||
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
||||
# define BOOST_RESULT_OF_NUM_ARGS 10
|
||||
# define BOOST_RESULT_OF_NUM_ARGS 16
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<typename F> struct result_of;
|
||||
template<typename F> struct tr1_result_of; // a TR1-style implementation of result_of
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
||||
|
||||
template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
|
||||
template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
|
||||
template<typename F> struct cpp0x_result_of_impl;
|
||||
|
||||
template<typename F>
|
||||
struct result_of_void_impl
|
||||
@ -51,8 +61,13 @@ struct result_of_void_impl<R (&)(void)>
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
// Determine the return type of a function pointer or pointer to member.
|
||||
template<typename F, typename FArgs>
|
||||
struct result_of_impl<F, FArgs, true>
|
||||
struct result_of_pointer
|
||||
: tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
|
||||
|
||||
template<typename F, typename FArgs>
|
||||
struct tr1_result_of_impl<F, FArgs, true>
|
||||
{
|
||||
typedef typename F::result_type type;
|
||||
};
|
||||
@ -68,10 +83,10 @@ struct result_of_nested_result : F::template result<FArgs>
|
||||
{};
|
||||
|
||||
template<typename F, typename FArgs>
|
||||
struct result_of_impl<F, FArgs, false>
|
||||
struct tr1_result_of_impl<F, FArgs, false>
|
||||
: mpl::if_<is_function_with_no_args<FArgs>,
|
||||
result_of_void_impl<F>,
|
||||
result_of_nested_result<F, FArgs> >::type
|
||||
result_of_void_impl<F>,
|
||||
result_of_nested_result<F, FArgs> >::type
|
||||
{};
|
||||
|
||||
} // end namespace detail
|
||||
|
55
include/boost/utility/swap.hpp
Normal file
55
include/boost/utility/swap.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
|
||||
#ifndef BOOST_UTILITY_SWAP_HPP
|
||||
#define BOOST_UTILITY_SWAP_HPP
|
||||
|
||||
// Note: the implementation of this utility contains various workarounds:
|
||||
// - swap_impl is put outside the boost namespace, to avoid infinite
|
||||
// recursion (causing stack overflow) when swapping objects of a primitive
|
||||
// type.
|
||||
// - swap_impl has a using-directive, rather than a using-declaration,
|
||||
// because some compilers (including MSVC 7.1, Borland 5.9.3, and
|
||||
// Intel 8.1) don't do argument-dependent lookup when it has a
|
||||
// using-declaration instead.
|
||||
// - boost::swap has two template arguments, instead of one, to
|
||||
// avoid ambiguity when swapping objects of a Boost type that does
|
||||
// not have its own boost::swap overload.
|
||||
|
||||
#include <algorithm> //for std::swap
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
namespace boost_swap_impl
|
||||
{
|
||||
template<class T>
|
||||
void swap_impl(T& left, T& right)
|
||||
{
|
||||
using namespace std;//use std::swap if argument dependent lookup fails
|
||||
swap(left,right);
|
||||
}
|
||||
|
||||
template<class T, std::size_t N>
|
||||
void swap_impl(T (& left)[N], T (& right)[N])
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
::boost_swap_impl::swap_impl(left[i], right[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class T1, class T2>
|
||||
void swap(T1& left, T2& right)
|
||||
{
|
||||
::boost_swap_impl::swap_impl(left, right);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -5,7 +5,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
@ -54,8 +54,8 @@ public:
|
||||
|
||||
void* apply (void* address, std::size_t n) const
|
||||
{
|
||||
for(char* next = address = this->apply(address); !! --n;)
|
||||
this->apply(next = next+sizeof(T));
|
||||
for(void* next = address = this->apply(address); !! --n;)
|
||||
this->apply(next = static_cast<char *>(next) + sizeof(T));
|
||||
return address;
|
||||
}
|
||||
|
||||
|
@ -1,81 +1,258 @@
|
||||
// (C) 2002, Fernando Luis Cacciola Carballal.
|
||||
// (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// 21 Ago 2002 (Created) Fernando Cacciola
|
||||
// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker
|
||||
// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola
|
||||
// 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola
|
||||
// 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola
|
||||
// 03 Apr 2010 (Added initialized<T>, suggested by Jeffrey Hellrung, fixing #3472) Niels Dekker
|
||||
// 30 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker
|
||||
//
|
||||
#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
|
||||
#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
|
||||
|
||||
#include <boost/detail/select_type.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
// Note: The implementation of boost::value_initialized had to deal with the
|
||||
// fact that various compilers haven't fully implemented value-initialization.
|
||||
// The constructor of boost::value_initialized<T> works around these compiler
|
||||
// issues, by clearing the bytes of T, before constructing the T object it
|
||||
// contains. More details on these issues are at libs/utility/value_init.htm
|
||||
|
||||
#include <boost/aligned_storage.hpp>
|
||||
#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#if _MSC_VER >= 1310
|
||||
// It is safe to ignore the following warning from MSVC 7.1 or higher:
|
||||
// "warning C4351: new behavior: elements of array will be default initialized"
|
||||
#pragma warning(disable: 4351)
|
||||
// It is safe to ignore the following MSVC warning, which may pop up when T is
|
||||
// a const type: "warning C4512: assignment operator could not be generated".
|
||||
#pragma warning(disable: 4512)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
// Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
|
||||
// suggests that a workaround should be applied, because of compiler issues
|
||||
// regarding value-initialization.
|
||||
#define BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
|
||||
#endif
|
||||
|
||||
// Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND
|
||||
// switches the value-initialization workaround either on or off.
|
||||
#ifndef BOOST_DETAIL_VALUE_INIT_WORKAROUND
|
||||
#ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
|
||||
#define BOOST_DETAIL_VALUE_INIT_WORKAROUND 1
|
||||
#else
|
||||
#define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace vinit_detail {
|
||||
|
||||
template<class T>
|
||||
class const_T_base
|
||||
class initialized
|
||||
{
|
||||
protected :
|
||||
|
||||
const_T_base() : x() {}
|
||||
|
||||
T x ;
|
||||
} ;
|
||||
|
||||
template<class T>
|
||||
struct non_const_T_base
|
||||
{
|
||||
protected :
|
||||
|
||||
non_const_T_base() : x() {}
|
||||
|
||||
mutable T x ;
|
||||
} ;
|
||||
|
||||
template<class T>
|
||||
struct select_base
|
||||
{
|
||||
typedef
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
typename
|
||||
private :
|
||||
struct wrapper
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
typename
|
||||
#endif
|
||||
::boost::detail::if_true< ::boost::is_const<T>::value >
|
||||
::template then< const_T_base<T>, non_const_T_base<T> >::type type ;
|
||||
} ;
|
||||
remove_const<T>::type data;
|
||||
|
||||
} // namespace vinit_detail
|
||||
wrapper()
|
||||
:
|
||||
data()
|
||||
{
|
||||
}
|
||||
|
||||
wrapper(T const & arg)
|
||||
:
|
||||
data(arg)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
mutable
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
typename
|
||||
#endif
|
||||
aligned_storage<sizeof(wrapper), alignment_of<wrapper>::value>::type x;
|
||||
|
||||
wrapper * wrapper_address() const
|
||||
{
|
||||
return static_cast<wrapper *>( static_cast<void*>(&x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
class value_initialized : private vinit_detail::select_base<T>::type
|
||||
{
|
||||
public :
|
||||
|
||||
value_initialized() {}
|
||||
initialized()
|
||||
{
|
||||
#if BOOST_DETAIL_VALUE_INIT_WORKAROUND
|
||||
std::memset(&x, 0, sizeof(x));
|
||||
#endif
|
||||
new (wrapper_address()) wrapper();
|
||||
}
|
||||
|
||||
operator T&() const { return this->x ; }
|
||||
initialized(initialized const & arg)
|
||||
{
|
||||
new (wrapper_address()) wrapper( static_cast<wrapper const &>(*(arg.wrapper_address())));
|
||||
}
|
||||
|
||||
T& data() const { return this->x ; }
|
||||
explicit initialized(T const & arg)
|
||||
{
|
||||
new (wrapper_address()) wrapper(arg);
|
||||
}
|
||||
|
||||
initialized & operator=(initialized const & arg)
|
||||
{
|
||||
// Assignment is only allowed when T is non-const.
|
||||
BOOST_STATIC_ASSERT( ! is_const<T>::value );
|
||||
*wrapper_address() = static_cast<wrapper const &>(*(arg.wrapper_address()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
~initialized()
|
||||
{
|
||||
wrapper_address()->wrapper::~wrapper();
|
||||
}
|
||||
|
||||
T const & data() const
|
||||
{
|
||||
return wrapper_address()->data;
|
||||
}
|
||||
|
||||
T& data()
|
||||
{
|
||||
return wrapper_address()->data;
|
||||
}
|
||||
|
||||
void swap(initialized & arg)
|
||||
{
|
||||
::boost::swap( this->data(), arg.data() );
|
||||
}
|
||||
|
||||
operator T const &() const
|
||||
{
|
||||
return wrapper_address()->data;
|
||||
}
|
||||
|
||||
operator T&()
|
||||
{
|
||||
return wrapper_address()->data;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
template<class T>
|
||||
T const& get ( initialized<T> const& x )
|
||||
{
|
||||
return x.data() ;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T& get ( initialized<T>& x )
|
||||
{
|
||||
return x.data() ;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void swap ( initialized<T> & lhs, initialized<T> & rhs )
|
||||
{
|
||||
lhs.swap(rhs) ;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
class value_initialized
|
||||
{
|
||||
private :
|
||||
|
||||
// initialized<T> does value-initialization by default.
|
||||
initialized<T> m_data;
|
||||
|
||||
public :
|
||||
|
||||
value_initialized()
|
||||
:
|
||||
m_data()
|
||||
{ }
|
||||
|
||||
T const & data() const
|
||||
{
|
||||
return m_data.data();
|
||||
}
|
||||
|
||||
T& data()
|
||||
{
|
||||
return m_data.data();
|
||||
}
|
||||
|
||||
void swap(value_initialized & arg)
|
||||
{
|
||||
m_data.swap(arg.m_data);
|
||||
}
|
||||
|
||||
operator T const &() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
operator T&()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
template<class T>
|
||||
T const& get ( value_initialized<T> const& x )
|
||||
{
|
||||
return x.data() ;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T& get ( value_initialized<T>& x )
|
||||
{
|
||||
return x.data() ;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void swap ( value_initialized<T> & lhs, value_initialized<T> & rhs )
|
||||
{
|
||||
lhs.swap(rhs) ;
|
||||
}
|
||||
|
||||
|
||||
class initialized_value_t
|
||||
{
|
||||
public :
|
||||
|
||||
template <class T> operator T() const
|
||||
{
|
||||
return initialized<T>().data();
|
||||
}
|
||||
};
|
||||
|
||||
initialized_value_t const initialized_value = {} ;
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
18
index.html
18
index.html
@ -14,21 +14,31 @@
|
||||
<p>But that doesn't mean there isn't useful stuff here. Take a look:</p>
|
||||
<blockquote>
|
||||
<p>
|
||||
<a href="utility.htm#addressof">addressof</a><br>
|
||||
<a href="assert.html">assert</a><br>
|
||||
<a href="base_from_member.html">base_from_member</a><br>
|
||||
<a href="utility.htm#BOOST_BINARY">BOOST_BINARY</a><br>
|
||||
<a href="call_traits.htm">call_traits</a><br>
|
||||
<a href="checked_delete.html">checked_delete</a><br>
|
||||
<a href="compressed_pair.htm">compressed_pair</a><br>
|
||||
<a href="current_function.html">current_function</a><br>
|
||||
<a href="enable_if.html">enable_if</a><br>
|
||||
<a href="iterator_adaptors.htm">iterator_adaptors</a><br>
|
||||
<a href="doc/html/declval.html">declval</a><br>
|
||||
<a href="enable_if.html">enable_if</a><br>
|
||||
<a href="in_place_factories.html">in_place_factory</a><br>
|
||||
<a href="iterator_adaptors.htm">iterator_adaptors</a><br>
|
||||
<a href="generator_iterator.htm">generator iterator adaptors</a><br>
|
||||
<a href="utility.htm#functions_next_prior">next/prior</a><br>
|
||||
<a href="utility.htm#Class_noncopyable">noncopyable</a><br>
|
||||
<a href="operators.htm">operators</a><br>
|
||||
<a href="utility.htm#result_of">result_of</a><br>
|
||||
<a href="swap.html">swap</a><br>
|
||||
<a href="throw_exception.html">throw_exception</a><br>
|
||||
<a href="utility.htm">utility</a><br>
|
||||
<a href="value_init.htm">value_init</a></p>
|
||||
<a href="value_init.htm">value_init</a>
|
||||
</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2001</p>
|
||||
<p>© Copyright Beman Dawes, 2001</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0. (See
|
||||
accompanying file <a href="../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at
|
||||
|
116
initialized_test.cpp
Normal file
116
initialized_test.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
// Copyright 2010, Niels Dekker.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Test program for boost::initialized<T>.
|
||||
//
|
||||
// 2 May 2010 (Created) Niels Dekker
|
||||
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
// Typical use case for boost::initialized<T>: A generic class that
|
||||
// holds a value of type T, which must be initialized by either
|
||||
// value-initialization or direct-initialization.
|
||||
template <class T> class key_value_pair
|
||||
{
|
||||
std::string m_key;
|
||||
boost::initialized<T> m_value;
|
||||
public:
|
||||
|
||||
// Value-initializes the object held by m_value.
|
||||
key_value_pair() { }
|
||||
|
||||
// Value-initializes the object held by m_value.
|
||||
explicit key_value_pair(const std::string& key)
|
||||
:
|
||||
m_key(key)
|
||||
{
|
||||
}
|
||||
|
||||
// Direct-initializes the object held by m_value.
|
||||
key_value_pair(const std::string& key, const T& value)
|
||||
:
|
||||
m_key(key), m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
const T& get_value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Tells whether the argument is value-initialized.
|
||||
bool is_value_initialized(const int& arg)
|
||||
{
|
||||
return arg == 0;
|
||||
}
|
||||
|
||||
|
||||
// Tells whether the argument is value-initialized.
|
||||
bool is_value_initialized(const std::string& arg)
|
||||
{
|
||||
return arg.empty();
|
||||
}
|
||||
|
||||
struct foo
|
||||
{
|
||||
int data;
|
||||
};
|
||||
|
||||
bool operator==(const foo& lhs, const foo& rhs)
|
||||
{
|
||||
return lhs.data == rhs.data;
|
||||
}
|
||||
|
||||
|
||||
// Tells whether the argument is value-initialized.
|
||||
bool is_value_initialized(const foo& arg)
|
||||
{
|
||||
return arg.data == 0;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void test_key_value_pair(const T& magic_value)
|
||||
{
|
||||
// The value component of a default key_value_pair must be value-initialized.
|
||||
key_value_pair<T> default_key_value_pair;
|
||||
BOOST_TEST( is_value_initialized(default_key_value_pair.get_value() ) );
|
||||
|
||||
// The value component of a key_value_pair that only has its key explicitly specified
|
||||
// must also be value-initialized.
|
||||
BOOST_TEST( is_value_initialized(key_value_pair<T>("key").get_value()) );
|
||||
|
||||
// However, the value component of the following key_value_pair must be
|
||||
// "magic_value", as it must be direct-initialized.
|
||||
BOOST_TEST( key_value_pair<T>("key", magic_value).get_value() == magic_value );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Tests boost::initialize for a fundamental type, a type with a
|
||||
// user-defined constructor, and a user-defined type without
|
||||
// a user-defined constructor.
|
||||
int main()
|
||||
{
|
||||
|
||||
const int magic_number = 42;
|
||||
test_key_value_pair(magic_number);
|
||||
|
||||
const std::string magic_string = "magic value";
|
||||
test_key_value_pair(magic_string);
|
||||
|
||||
const foo magic_foo = { 42 };
|
||||
test_key_value_pair(magic_foo);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
33
initialized_test_fail1.cpp
Normal file
33
initialized_test_fail1.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2010, Niels Dekker.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Test program for boost::initialized<T>. Must fail to compile.
|
||||
//
|
||||
// Initial: 2 May 2010
|
||||
|
||||
#include <boost/utility/value_init.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
void direct_initialize_from_int()
|
||||
{
|
||||
// Okay: initialized<T> supports direct-initialization from T.
|
||||
boost::initialized<int> direct_initialized_int(1);
|
||||
}
|
||||
|
||||
void copy_initialize_from_int()
|
||||
{
|
||||
// The following line should not compile, because initialized<T>
|
||||
// was not intended to supports copy-initialization from T.
|
||||
boost::initialized<int> copy_initialized_int = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// This should fail to compile, so there is no need to call any function.
|
||||
return 0;
|
||||
}
|
37
initialized_test_fail2.cpp
Normal file
37
initialized_test_fail2.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright 2010, Niels Dekker.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Test program for boost::initialized<T>. Must fail to compile.
|
||||
//
|
||||
// Initial: 2 May 2010
|
||||
|
||||
#include <boost/utility/value_init.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
void from_value_initialized_to_initialized()
|
||||
{
|
||||
boost::value_initialized<int> value_initialized_int;
|
||||
|
||||
// Okay: initialized<T> can be initialized by value_initialized<T>.
|
||||
boost::initialized<int> initialized_int(value_initialized_int);
|
||||
}
|
||||
|
||||
void from_initialized_to_value_initialized()
|
||||
{
|
||||
boost::initialized<int> initialized_int(13);
|
||||
|
||||
// The following line should not compile, because initialized<T>
|
||||
// should not be convertible to value_initialized<T>.
|
||||
boost::value_initialized<int> value_initialized_int(initialized_int);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// This should fail to compile, so there is no need to call any function.
|
||||
return 0;
|
||||
}
|
103
operators.htm
103
operators.htm
@ -132,18 +132,18 @@
|
||||
class MyInt
|
||||
: boost::operators<MyInt>
|
||||
{
|
||||
bool operator<(const MyInt& x) const;
|
||||
bool operator<(const MyInt& x) const;
|
||||
bool operator==(const MyInt& x) const;
|
||||
MyInt& operator+=(const MyInt& x);
|
||||
MyInt& operator-=(const MyInt& x);
|
||||
MyInt& operator*=(const MyInt& x);
|
||||
MyInt& operator/=(const MyInt& x);
|
||||
MyInt& operator%=(const MyInt& x);
|
||||
MyInt& operator|=(const MyInt& x);
|
||||
MyInt& operator&=(const MyInt& x);
|
||||
MyInt& operator^=(const MyInt& x);
|
||||
MyInt& operator++();
|
||||
MyInt& operator--();
|
||||
MyInt& operator+=(const MyInt& x);
|
||||
MyInt& operator-=(const MyInt& x);
|
||||
MyInt& operator*=(const MyInt& x);
|
||||
MyInt& operator/=(const MyInt& x);
|
||||
MyInt& operator%=(const MyInt& x);
|
||||
MyInt& operator|=(const MyInt& x);
|
||||
MyInt& operator&=(const MyInt& x);
|
||||
MyInt& operator^=(const MyInt& x);
|
||||
MyInt& operator++();
|
||||
MyInt& operator--();
|
||||
};
|
||||
</pre>
|
||||
</blockquote>
|
||||
@ -345,7 +345,7 @@ class MyInt
|
||||
</ul>
|
||||
|
||||
<p>As Daniel Krügler pointed out, this technique violates 14.6.5/2
|
||||
and is thus non-portable. The reasoning is, that the operators injected
|
||||
and is thus non-portable. The reasoning is, that the operators injected
|
||||
by the instantiation of e.g.
|
||||
<code>less_than_comparable<myclass></code> can not be found
|
||||
by ADL according to the rules given by 3.4.2/2, since myclass is
|
||||
@ -445,6 +445,9 @@ const point<float> pi_over_4_normalized = pi_over_4 / length(pi_over_4);
|
||||
optional template parameter <code>B</code>, which is not shown, for the
|
||||
<a href="#chaining">base class chaining</a> technique.</p>
|
||||
|
||||
<p>The primary operand type <code>T</code> needs to be of class type,
|
||||
built-in types are not supported.</p>
|
||||
|
||||
<table cellpadding="5" border="1" align="center">
|
||||
<caption>
|
||||
Simple Arithmetic Operator Template Classes
|
||||
@ -917,7 +920,7 @@ T operator+( const T& lhs, const T& rhs )
|
||||
created, <code>operator+=</code> is called on it and it is copied to the
|
||||
function return value (which is another unnamed object of type
|
||||
<code>T</code>). The standard doesn't generally allow the intermediate
|
||||
object to be optimized away:
|
||||
object to be optimized away:
|
||||
|
||||
<blockquote>
|
||||
3.7.2/2: Automatic storage duration<br>
|
||||
@ -928,7 +931,7 @@ T operator+( const T& lhs, const T& rhs )
|
||||
unused, except that a class object or its copy may be eliminated as
|
||||
specified in 12.8.
|
||||
</blockquote>
|
||||
The reference to 12.8 is important for us:
|
||||
The reference to 12.8 is important for us:
|
||||
|
||||
<blockquote>
|
||||
12.8/15: Copying class objects<br>
|
||||
@ -942,7 +945,7 @@ T operator+( const T& lhs, const T& rhs )
|
||||
</blockquote>
|
||||
This optimization is known as the named return value optimization (NRVO),
|
||||
which leads us to the following implementation for
|
||||
<code>operator+</code>:
|
||||
<code>operator+</code>:
|
||||
<pre>
|
||||
T operator+( const T& lhs, const T& rhs )
|
||||
{
|
||||
@ -956,7 +959,7 @@ T operator+( const T& lhs, const T& rhs )
|
||||
even implement it in an incorrect way which makes it useless here.
|
||||
Without the NRVO, the NRVO-friendly code is no worse than the original
|
||||
code showed above, but there is another possible implementation, which
|
||||
has some very special properties:
|
||||
has some very special properties:
|
||||
<pre>
|
||||
T operator+( T lhs, const T& rhs )
|
||||
{
|
||||
@ -982,7 +985,7 @@ T operator+( T lhs, const T& rhs )
|
||||
will force the NRVO-friendly implementation to be used even for compilers
|
||||
that don't implement the NRVO. <br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="grpd_oprs">Grouped Arithmetic Operators</a></h3>
|
||||
|
||||
<p>The following templates provide common groups of related operations.
|
||||
@ -1420,9 +1423,9 @@ T operator+( T lhs, const T& rhs )
|
||||
|
||||
<tr>
|
||||
<td><code><a name=
|
||||
"euclidian_ring_operators1">euclidian_ring_operators<T></a></code><br>
|
||||
"euclidean_ring_operators1">euclidean_ring_operators<T></a></code><br>
|
||||
|
||||
<code>euclidian_ring_operators1<T></code></td>
|
||||
<code>euclidean_ring_operators1<T></code></td>
|
||||
|
||||
<td>
|
||||
<ul>
|
||||
@ -1439,9 +1442,9 @@ T operator+( T lhs, const T& rhs )
|
||||
|
||||
<tr>
|
||||
<td><code><a name=
|
||||
"euclidian_ring_operators2">euclidian_ring_operators<T,
|
||||
"euclidean_ring_operators2">euclidean_ring_operators<T,
|
||||
U></a></code><br>
|
||||
<code>euclidian_ring_operators2<T, U></code></td>
|
||||
<code>euclidean_ring_operators2<T, U></code></td>
|
||||
|
||||
<td>
|
||||
<ul>
|
||||
@ -1464,14 +1467,14 @@ T operator+( T lhs, const T& rhs )
|
||||
|
||||
<tr>
|
||||
<td><code><a name=
|
||||
"ordered_euclidian_ring_operators1">ordered_euclidian_ring_operators<T></a></code><br>
|
||||
"ordered_euclidean_ring_operators1">ordered_euclidean_ring_operators<T></a></code><br>
|
||||
|
||||
<code>ordered_euclidian_ring_operators1<T></code></td>
|
||||
<code>ordered_euclidean_ring_operators1<T></code></td>
|
||||
|
||||
<td>
|
||||
<ul>
|
||||
<li><code><a href=
|
||||
"#euclidian_ring_operators1">euclidian_ring_operators<T></a></code></li>
|
||||
"#euclidean_ring_operators1">euclidean_ring_operators<T></a></code></li>
|
||||
|
||||
<li><code><a href=
|
||||
"#totally_ordered1">totally_ordered<T></a></code></li>
|
||||
@ -1481,14 +1484,14 @@ T operator+( T lhs, const T& rhs )
|
||||
|
||||
<tr>
|
||||
<td><code><a name=
|
||||
"ordered_euclidian_ring_operators2">ordered_euclidian_ring_operators<T,
|
||||
"ordered_euclidean_ring_operators2">ordered_euclidean_ring_operators<T,
|
||||
U></a></code><br>
|
||||
<code>ordered_euclidian_ring_operators2<T, U></code></td>
|
||||
<code>ordered_euclidean_ring_operators2<T, U></code></td>
|
||||
|
||||
<td>
|
||||
<ul>
|
||||
<li><code><a href=
|
||||
"#euclidian_ring_operators2">euclidian_ring_operators<T,
|
||||
"#euclidean_ring_operators2">euclidean_ring_operators<T,
|
||||
U></a></code></li>
|
||||
|
||||
<li><code><a href="#totally_ordered2">totally_ordered<T,
|
||||
@ -1498,6 +1501,15 @@ T operator+( T lhs, const T& rhs )
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>Spelling: euclidean vs. euclidian</h4>
|
||||
|
||||
<p>Older versions of the Boost.Operators library used
|
||||
"<code>euclidian</code>", but it was pointed out that
|
||||
"<code>euclidean</code>" is the more common spelling.
|
||||
To be compatible with older version, the library now supports
|
||||
both spellings.
|
||||
</p>
|
||||
|
||||
<h3><a name="ex_oprs">Example</a> Templates</h3>
|
||||
|
||||
<p>The arithmetic operator class templates <code><a href=
|
||||
@ -1576,9 +1588,8 @@ T operator+( T lhs, const T& rhs )
|
||||
|
||||
<p>The <cite><a href="operators_test.cpp">operators_test.cpp</a></cite>
|
||||
program demonstrates the use of the arithmetic operator templates, and
|
||||
can also be used to verify correct operation. Check the <a href=
|
||||
"../../status/compiler_status.html">compiler status report</a> for the
|
||||
test results with selected platforms.</p>
|
||||
can also be used to verify correct operation. Check the compiler status
|
||||
report for the test results with selected platforms.</p>
|
||||
|
||||
<h2><a name="deref">Dereference</a> Operators and Iterator Helpers</h2>
|
||||
|
||||
@ -1856,7 +1867,7 @@ T operator+( T lhs, const T& rhs )
|
||||
V, D, P, R></a></code></td>
|
||||
|
||||
<td>
|
||||
Supports the operations and has the requirements of
|
||||
Supports the operations and has the requirements of
|
||||
|
||||
<ul>
|
||||
<li><code><a href="#input_iteratable">input_iteratable<T,
|
||||
@ -1870,7 +1881,7 @@ T operator+( T lhs, const T& rhs )
|
||||
"output_iterator_helper">output_iterator_helper<T></a></code></td>
|
||||
|
||||
<td>
|
||||
Supports the operations and has the requirements of
|
||||
Supports the operations and has the requirements of
|
||||
|
||||
<ul>
|
||||
<li><code><a href=
|
||||
@ -1886,7 +1897,7 @@ T operator+( T lhs, const T& rhs )
|
||||
R></a></code></td>
|
||||
|
||||
<td>
|
||||
Supports the operations and has the requirements of
|
||||
Supports the operations and has the requirements of
|
||||
|
||||
<ul>
|
||||
<li><code><a href="#forward_iteratable">forward_iteratable<T,
|
||||
@ -1901,7 +1912,7 @@ T operator+( T lhs, const T& rhs )
|
||||
V, D, P, R></a></code></td>
|
||||
|
||||
<td>
|
||||
Supports the operations and has the requirements of
|
||||
Supports the operations and has the requirements of
|
||||
|
||||
<ul>
|
||||
<li><code><a href=
|
||||
@ -1917,7 +1928,7 @@ T operator+( T lhs, const T& rhs )
|
||||
V, D, P, R></a></code></td>
|
||||
|
||||
<td>
|
||||
Supports the operations and has the requirements of
|
||||
Supports the operations and has the requirements of
|
||||
|
||||
<ul>
|
||||
<li><code><a href=
|
||||
@ -1968,8 +1979,8 @@ struct function_output_iterator
|
||||
template<typename T>
|
||||
function_output_iterator& operator=(T const& value)
|
||||
{
|
||||
this->func(value);
|
||||
return *this;
|
||||
this->func(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -2022,20 +2033,20 @@ public:
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>Check the <a href="../../status/compiler_status.html">compiler status
|
||||
<p>Check the <a href="http://www.boost.org/development/testing.html">compiler status
|
||||
report</a> for the test results with selected platforms.</p>
|
||||
<hr>
|
||||
|
||||
<h2><a name="contributors">Contributors</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="../../people/dave_abrahams.htm">Dave Abrahams</a></dt>
|
||||
<dt><a href="http://www.boost.org/people/dave_abrahams.htm">Dave Abrahams</a></dt>
|
||||
|
||||
<dd>Started the library and contributed the arithmetic operators in
|
||||
<cite><a href=
|
||||
"../../boost/operators.hpp">boost/operators.hpp</a></cite>.</dd>
|
||||
|
||||
<dt><a href="../../people/jeremy_siek.htm">Jeremy Siek</a></dt>
|
||||
<dt><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a></dt>
|
||||
|
||||
<dd>Contributed the <a href="#deref">dereference operators and iterator
|
||||
helpers</a> in <cite><a href=
|
||||
@ -2043,19 +2054,19 @@ public:
|
||||
contributed <cite><a href=
|
||||
"iterators_test.cpp">iterators_test.cpp</a></cite>.</dd>
|
||||
|
||||
<dt><a href="../../people/aleksey_gurtovoy.htm">Aleksey
|
||||
<dt><a href="http://www.boost.org/people/aleksey_gurtovoy.htm">Aleksey
|
||||
Gurtovoy</a></dt>
|
||||
|
||||
<dd>Contributed the code to support <a href="#chaining">base class
|
||||
chaining</a> while remaining backward-compatible with old versions of
|
||||
the library.</dd>
|
||||
|
||||
<dt><a href="../../people/beman_dawes.html">Beman Dawes</a></dt>
|
||||
<dt><a href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a></dt>
|
||||
|
||||
<dd>Contributed <cite><a href=
|
||||
"operators_test.cpp">operators_test.cpp</a></cite>.</dd>
|
||||
|
||||
<dt><a href="../../people/daryle_walker.html">Daryle Walker</a></dt>
|
||||
<dt><a href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a></dt>
|
||||
|
||||
<dd>Contributed classes for the shift operators, equivalence, partial
|
||||
ordering, and arithmetic conversions. Added the grouped operator
|
||||
@ -2119,11 +2130,11 @@ public:
|
||||
backward-compatible.</p>
|
||||
<hr>
|
||||
|
||||
<p>Revised: 29 Oct 2004</p>
|
||||
<p>Revised: 7 Aug 2008</p>
|
||||
|
||||
<p>Copyright © Beman Dawes, David Abrahams, 1999-2001.</p>
|
||||
<p>Copyright © Daniel Frey, 2002-2004.</p>
|
||||
<p>Use, modification, and distribution is subject to the Boost Software
|
||||
<p>Copyright © Daniel Frey, 2002-2009.</p>
|
||||
<p>Use, modification, and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file
|
||||
<a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
@ -7,6 +7,7 @@
|
||||
// See http://www.boost.org/libs/utility for documentation.
|
||||
|
||||
// Revision History
|
||||
// 03 Apr 08 Added convertible_to_bool (Daniel Frey)
|
||||
// 01 Oct 01 Added tests for "left" operators
|
||||
// and new grouped operators. (Helmut Zeisel)
|
||||
// 20 May 01 Output progress messages. Added tests for new operator
|
||||
@ -43,6 +44,23 @@ namespace
|
||||
unsigned char true_value(unsigned char x) { return x; }
|
||||
unsigned short true_value(unsigned short x) { return x; }
|
||||
|
||||
// verify the minimum requirements for some operators
|
||||
class convertible_to_bool
|
||||
{
|
||||
private:
|
||||
bool _value;
|
||||
|
||||
typedef bool convertible_to_bool::*unspecified_bool_type;
|
||||
|
||||
void operator!() const;
|
||||
|
||||
public:
|
||||
convertible_to_bool( const bool value ) : _value( value ) {}
|
||||
|
||||
operator unspecified_bool_type() const
|
||||
{ return _value ? &convertible_to_bool::_value : 0; }
|
||||
};
|
||||
|
||||
// The use of operators<> here tended to obscure
|
||||
// interactions with certain compiler bugs
|
||||
template <class T>
|
||||
@ -54,8 +72,10 @@ namespace
|
||||
explicit Wrapped1( T v = T() ) : _value(v) {}
|
||||
T value() const { return _value; }
|
||||
|
||||
bool operator<(const Wrapped1& x) const { return _value < x._value; }
|
||||
bool operator==(const Wrapped1& x) const { return _value == x._value; }
|
||||
convertible_to_bool operator<(const Wrapped1& x) const
|
||||
{ return _value < x._value; }
|
||||
convertible_to_bool operator==(const Wrapped1& x) const
|
||||
{ return _value == x._value; }
|
||||
|
||||
Wrapped1& operator+=(const Wrapped1& x)
|
||||
{ _value += x._value; return *this; }
|
||||
@ -97,8 +117,10 @@ namespace
|
||||
explicit Wrapped2( T v = T() ) : _value(v) {}
|
||||
T value() const { return _value; }
|
||||
|
||||
bool operator<(const Wrapped2& x) const { return _value < x._value; }
|
||||
bool operator==(const Wrapped2& x) const { return _value == x._value; }
|
||||
convertible_to_bool operator<(const Wrapped2& x) const
|
||||
{ return _value < x._value; }
|
||||
convertible_to_bool operator==(const Wrapped2& x) const
|
||||
{ return _value == x._value; }
|
||||
|
||||
Wrapped2& operator+=(const Wrapped2& x)
|
||||
{ _value += x._value; return *this; }
|
||||
@ -123,9 +145,13 @@ namespace
|
||||
Wrapped2& operator++() { ++_value; return *this; }
|
||||
Wrapped2& operator--() { --_value; return *this; }
|
||||
|
||||
bool operator<(U u) const { return _value < u; }
|
||||
bool operator>(U u) const { return _value > u; }
|
||||
bool operator==(U u) const { return _value == u; }
|
||||
convertible_to_bool operator<(U u) const
|
||||
{ return _value < u; }
|
||||
convertible_to_bool operator>(U u) const
|
||||
{ return _value > u; }
|
||||
convertible_to_bool operator==(U u) const
|
||||
{ return _value == u; }
|
||||
|
||||
Wrapped2& operator+=(U u) { _value += u; return *this; }
|
||||
Wrapped2& operator-=(U u) { _value -= u; return *this; }
|
||||
Wrapped2& operator*=(U u) { _value *= u; return *this; }
|
||||
@ -153,7 +179,8 @@ namespace
|
||||
explicit Wrapped3( T v = T() ) : _value(v) {}
|
||||
T value() const { return _value; }
|
||||
|
||||
bool operator<(const Wrapped3& x) const { return _value < x._value; }
|
||||
convertible_to_bool operator<(const Wrapped3& x) const
|
||||
{ return _value < x._value; }
|
||||
|
||||
private:
|
||||
T _value;
|
||||
@ -174,10 +201,13 @@ namespace
|
||||
explicit Wrapped4( T v = T() ) : _value(v) {}
|
||||
T value() const { return _value; }
|
||||
|
||||
bool operator<(const Wrapped4& x) const { return _value < x._value; }
|
||||
convertible_to_bool operator<(const Wrapped4& x) const
|
||||
{ return _value < x._value; }
|
||||
|
||||
bool operator<(U u) const { return _value < u; }
|
||||
bool operator>(U u) const { return _value > u; }
|
||||
convertible_to_bool operator<(U u) const
|
||||
{ return _value < u; }
|
||||
convertible_to_bool operator>(U u) const
|
||||
{ return _value > u; }
|
||||
|
||||
private:
|
||||
T _value;
|
||||
@ -198,11 +228,18 @@ namespace
|
||||
Wrapped5(U u) : _value(u) {}
|
||||
|
||||
T value() const { return _value; }
|
||||
bool operator<(const Wrapped5& x) const { return _value < x._value; }
|
||||
bool operator<(U u) const { return _value < u; }
|
||||
bool operator>(U u) const { return _value > u; }
|
||||
bool operator==(const Wrapped5& u) const { return _value == u._value; }
|
||||
bool operator==(U u) const { return _value == u; }
|
||||
|
||||
convertible_to_bool operator<(const Wrapped5& x) const
|
||||
{ return _value < x._value; }
|
||||
convertible_to_bool operator<(U u) const
|
||||
{ return _value < u; }
|
||||
convertible_to_bool operator>(U u) const
|
||||
{ return _value > u; }
|
||||
convertible_to_bool operator==(const Wrapped5& u) const
|
||||
{ return _value == u._value; }
|
||||
convertible_to_bool operator==(U u) const
|
||||
{ return _value == u; }
|
||||
|
||||
Wrapped5& operator/=(const Wrapped5& u) { _value /= u._value; return *this;}
|
||||
Wrapped5& operator/=(U u) { _value /= u; return *this;}
|
||||
Wrapped5& operator*=(const Wrapped5& u) { _value *= u._value; return *this;}
|
||||
@ -221,8 +258,8 @@ namespace
|
||||
// U must be convertible to T
|
||||
template <class T, class U>
|
||||
class Wrapped6
|
||||
: boost::ordered_euclidian_ring_operators2<Wrapped6<T, U>, U>
|
||||
, boost::ordered_euclidian_ring_operators1<Wrapped6<T, U> >
|
||||
: boost::ordered_euclidean_ring_operators2<Wrapped6<T, U>, U>
|
||||
, boost::ordered_euclidean_ring_operators1<Wrapped6<T, U> >
|
||||
{
|
||||
public:
|
||||
explicit Wrapped6( T v = T() ) : _value(v) {}
|
||||
@ -231,11 +268,18 @@ namespace
|
||||
Wrapped6(U u) : _value(u) {}
|
||||
|
||||
T value() const { return _value; }
|
||||
bool operator<(const Wrapped6& x) const { return _value < x._value; }
|
||||
bool operator<(U u) const { return _value < u; }
|
||||
bool operator>(U u) const { return _value > u; }
|
||||
bool operator==(const Wrapped6& u) const { return _value == u._value; }
|
||||
bool operator==(U u) const { return _value == u; }
|
||||
|
||||
convertible_to_bool operator<(const Wrapped6& x) const
|
||||
{ return _value < x._value; }
|
||||
convertible_to_bool operator<(U u) const
|
||||
{ return _value < u; }
|
||||
convertible_to_bool operator>(U u) const
|
||||
{ return _value > u; }
|
||||
convertible_to_bool operator==(const Wrapped6& u) const
|
||||
{ return _value == u._value; }
|
||||
convertible_to_bool operator==(U u) const
|
||||
{ return _value == u; }
|
||||
|
||||
Wrapped6& operator%=(const Wrapped6& u) { _value %= u._value; return *this;}
|
||||
Wrapped6& operator%=(U u) { _value %= u; return *this;}
|
||||
Wrapped6& operator/=(const Wrapped6& u) { _value /= u._value; return *this;}
|
||||
@ -276,10 +320,10 @@ namespace
|
||||
template <class X1, class Y1, class X2, class Y2>
|
||||
void test_less_than_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
|
||||
{
|
||||
BOOST_CHECK( (x1 < y1) == (x2 < y2) );
|
||||
BOOST_CHECK( (x1 <= y1) == (x2 <= y2) );
|
||||
BOOST_CHECK( (x1 >= y1) == (x2 >= y2) );
|
||||
BOOST_CHECK( (x1 > y1) == (x2 > y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 < y1) == static_cast<bool>(x2 < y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 <= y1) == static_cast<bool>(x2 <= y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 >= y1) == static_cast<bool>(x2 >= y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 > y1) == static_cast<bool>(x2 > y2) );
|
||||
}
|
||||
|
||||
template <class X1, class Y1, class X2, class Y2>
|
||||
@ -293,8 +337,8 @@ namespace
|
||||
template <class X1, class Y1, class X2, class Y2>
|
||||
void test_equality_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
|
||||
{
|
||||
BOOST_CHECK( (x1 == y1) == (x2 == y2) );
|
||||
BOOST_CHECK( (x1 != y1) == (x2 != y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 == y1) == static_cast<bool>(x2 == y2) );
|
||||
BOOST_CHECK( static_cast<bool>(x1 != y1) == static_cast<bool>(x2 != y2) );
|
||||
}
|
||||
|
||||
template <class X1, class Y1, class X2, class Y2>
|
||||
@ -614,14 +658,14 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (i = i2), (i.value() == 2) );
|
||||
|
||||
BOOST_CHECK( i2 == i );
|
||||
BOOST_CHECK( i1 != i2 );
|
||||
BOOST_CHECK( i1 < i2 );
|
||||
BOOST_CHECK( i1 <= i2 );
|
||||
BOOST_CHECK( i <= i2 );
|
||||
BOOST_CHECK( i2 > i1 );
|
||||
BOOST_CHECK( i2 >= i1 );
|
||||
BOOST_CHECK( i2 >= i );
|
||||
BOOST_CHECK( static_cast<bool>(i2 == i) );
|
||||
BOOST_CHECK( static_cast<bool>(i1 != i2) );
|
||||
BOOST_CHECK( static_cast<bool>(i1 < i2) );
|
||||
BOOST_CHECK( static_cast<bool>(i1 <= i2) );
|
||||
BOOST_CHECK( static_cast<bool>(i <= i2) );
|
||||
BOOST_CHECK( static_cast<bool>(i2 > i1) );
|
||||
BOOST_CHECK( static_cast<bool>(i2 >= i1) );
|
||||
BOOST_CHECK( static_cast<bool>(i2 >= i) );
|
||||
|
||||
PRIVATE_EXPR_TEST( (i = i1 + i2), (i.value() == 3) );
|
||||
PRIVATE_EXPR_TEST( (i = i + i2), (i.value() == 5) );
|
||||
@ -653,78 +697,78 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (j = j2), (j.value() == 2) );
|
||||
|
||||
BOOST_CHECK( j2 == j );
|
||||
BOOST_CHECK( 2 == j );
|
||||
BOOST_CHECK( j2 == 2 );
|
||||
BOOST_CHECK( j == j2 );
|
||||
BOOST_CHECK( j1 != j2 );
|
||||
BOOST_CHECK( j1 != 2 );
|
||||
BOOST_CHECK( 1 != j2 );
|
||||
BOOST_CHECK( j1 < j2 );
|
||||
BOOST_CHECK( 1 < j2 );
|
||||
BOOST_CHECK( j1 < 2 );
|
||||
BOOST_CHECK( j1 <= j2 );
|
||||
BOOST_CHECK( 1 <= j2 );
|
||||
BOOST_CHECK( j1 <= j );
|
||||
BOOST_CHECK( j <= j2 );
|
||||
BOOST_CHECK( 2 <= j2 );
|
||||
BOOST_CHECK( j <= 2 );
|
||||
BOOST_CHECK( j2 > j1 );
|
||||
BOOST_CHECK( 2 > j1 );
|
||||
BOOST_CHECK( j2 > 1 );
|
||||
BOOST_CHECK( j2 >= j1 );
|
||||
BOOST_CHECK( 2 >= j1 );
|
||||
BOOST_CHECK( j2 >= 1 );
|
||||
BOOST_CHECK( j2 >= j );
|
||||
BOOST_CHECK( 2 >= j );
|
||||
BOOST_CHECK( j2 >= 2 );
|
||||
BOOST_CHECK( static_cast<bool>(j2 == j) );
|
||||
BOOST_CHECK( static_cast<bool>(2 == j) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 == 2) );
|
||||
BOOST_CHECK( static_cast<bool>(j == j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 != j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 != 2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 != j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 < j2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 < j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 < 2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 <= j2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 <= j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j1 <= j) );
|
||||
BOOST_CHECK( static_cast<bool>(j <= j2) );
|
||||
BOOST_CHECK( static_cast<bool>(2 <= j2) );
|
||||
BOOST_CHECK( static_cast<bool>(j <= 2) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 > j1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 > j1) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 > 1) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 >= j1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 >= j1) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 >= 1) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 >= j) );
|
||||
BOOST_CHECK( static_cast<bool>(2 >= j) );
|
||||
BOOST_CHECK( static_cast<bool>(j2 >= 2) );
|
||||
|
||||
BOOST_CHECK( (j1 + 2) == 3 );
|
||||
BOOST_CHECK( (1 + j2) == 3 );
|
||||
BOOST_CHECK( static_cast<bool>((j1 + 2) == 3) );
|
||||
BOOST_CHECK( static_cast<bool>((1 + j2) == 3) );
|
||||
PRIVATE_EXPR_TEST( (j = j1 + j2), (j.value() == 3) );
|
||||
|
||||
BOOST_CHECK( (j + 2) == 5 );
|
||||
BOOST_CHECK( (3 + j2) == 5 );
|
||||
BOOST_CHECK( static_cast<bool>((j + 2) == 5) );
|
||||
BOOST_CHECK( static_cast<bool>((3 + j2) == 5) );
|
||||
PRIVATE_EXPR_TEST( (j = j + j2), (j.value() == 5) );
|
||||
|
||||
BOOST_CHECK( (j - 1) == 4 );
|
||||
BOOST_CHECK( static_cast<bool>((j - 1) == 4) );
|
||||
PRIVATE_EXPR_TEST( (j = j - j1), (j.value() == 4) );
|
||||
|
||||
BOOST_CHECK( (j * 2) == 8 );
|
||||
BOOST_CHECK( (4 * j2) == 8 );
|
||||
BOOST_CHECK( static_cast<bool>((j * 2) == 8) );
|
||||
BOOST_CHECK( static_cast<bool>((4 * j2) == 8) );
|
||||
PRIVATE_EXPR_TEST( (j = j * j2), (j.value() == 8) );
|
||||
|
||||
BOOST_CHECK( (j / 2) == 4 );
|
||||
BOOST_CHECK( static_cast<bool>((j / 2) == 4) );
|
||||
PRIVATE_EXPR_TEST( (j = j / j2), (j.value() == 4) );
|
||||
|
||||
BOOST_CHECK( (j % 3) == 1 );
|
||||
BOOST_CHECK( static_cast<bool>((j % 3) == 1) );
|
||||
PRIVATE_EXPR_TEST( (j = j % ( j - j1 )), (j.value() == 1) );
|
||||
|
||||
PRIVATE_EXPR_TEST( (j = j2 + j2), (j.value() == 4) );
|
||||
|
||||
BOOST_CHECK( (1 | j2 | j) == 7 );
|
||||
BOOST_CHECK( (j1 | 2 | j) == 7 );
|
||||
BOOST_CHECK( (j1 | j2 | 4) == 7 );
|
||||
BOOST_CHECK( static_cast<bool>((1 | j2 | j) == 7) );
|
||||
BOOST_CHECK( static_cast<bool>((j1 | 2 | j) == 7) );
|
||||
BOOST_CHECK( static_cast<bool>((j1 | j2 | 4) == 7) );
|
||||
PRIVATE_EXPR_TEST( (j = j1 | j2 | j), (j.value() == 7) );
|
||||
|
||||
BOOST_CHECK( (7 & j2) == 2 );
|
||||
BOOST_CHECK( (j & 2) == 2 );
|
||||
BOOST_CHECK( static_cast<bool>((7 & j2) == 2) );
|
||||
BOOST_CHECK( static_cast<bool>((j & 2) == 2) );
|
||||
PRIVATE_EXPR_TEST( (j = j & j2), (j.value() == 2) );
|
||||
|
||||
PRIVATE_EXPR_TEST( (j = j | j1), (j.value() == 3) );
|
||||
|
||||
BOOST_CHECK( (3 ^ j1) == 2 );
|
||||
BOOST_CHECK( (j ^ 1) == 2 );
|
||||
BOOST_CHECK( static_cast<bool>((3 ^ j1) == 2) );
|
||||
BOOST_CHECK( static_cast<bool>((j ^ 1) == 2) );
|
||||
PRIVATE_EXPR_TEST( (j = j ^ j1), (j.value() == 2) );
|
||||
|
||||
PRIVATE_EXPR_TEST( (j = ( j + j1 ) * ( j2 | j1 )), (j.value() == 9) );
|
||||
|
||||
BOOST_CHECK( (j1 << 2) == 4 );
|
||||
BOOST_CHECK( (j2 << 1) == 4 );
|
||||
BOOST_CHECK( static_cast<bool>((j1 << 2) == 4) );
|
||||
BOOST_CHECK( static_cast<bool>((j2 << 1) == 4) );
|
||||
PRIVATE_EXPR_TEST( (j = j1 << j2), (j.value() == 4) );
|
||||
|
||||
BOOST_CHECK( (j >> 2) == 1 );
|
||||
BOOST_CHECK( (j2 >> 1) == 1 );
|
||||
BOOST_CHECK( static_cast<bool>((j >> 2) == 1) );
|
||||
BOOST_CHECK( static_cast<bool>((j2 >> 1) == 1) );
|
||||
PRIVATE_EXPR_TEST( (j = j2 >> j1), (j.value() == 1) );
|
||||
|
||||
cout << "Performed tests on MyLong objects.\n";
|
||||
@ -741,14 +785,14 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (k = k2), (k.value() == 2) );
|
||||
|
||||
BOOST_CHECK( k2 == k );
|
||||
BOOST_CHECK( k1 != k2 );
|
||||
BOOST_CHECK( k1 < k2 );
|
||||
BOOST_CHECK( k1 <= k2 );
|
||||
BOOST_CHECK( k <= k2 );
|
||||
BOOST_CHECK( k2 > k1 );
|
||||
BOOST_CHECK( k2 >= k1 );
|
||||
BOOST_CHECK( k2 >= k );
|
||||
BOOST_CHECK( static_cast<bool>(k2 == k) );
|
||||
BOOST_CHECK( static_cast<bool>(k1 != k2) );
|
||||
BOOST_CHECK( static_cast<bool>(k1 < k2) );
|
||||
BOOST_CHECK( static_cast<bool>(k1 <= k2) );
|
||||
BOOST_CHECK( static_cast<bool>(k <= k2) );
|
||||
BOOST_CHECK( static_cast<bool>(k2 > k1) );
|
||||
BOOST_CHECK( static_cast<bool>(k2 >= k1) );
|
||||
BOOST_CHECK( static_cast<bool>(k2 >= k) );
|
||||
|
||||
cout << "Performed tests on MyChar objects.\n";
|
||||
|
||||
@ -764,31 +808,31 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (l = l2), (l.value() == 2) );
|
||||
|
||||
BOOST_CHECK( l2 == l );
|
||||
BOOST_CHECK( 2 == l );
|
||||
BOOST_CHECK( l2 == 2 );
|
||||
BOOST_CHECK( l == l2 );
|
||||
BOOST_CHECK( l1 != l2 );
|
||||
BOOST_CHECK( l1 != 2 );
|
||||
BOOST_CHECK( 1 != l2 );
|
||||
BOOST_CHECK( l1 < l2 );
|
||||
BOOST_CHECK( 1 < l2 );
|
||||
BOOST_CHECK( l1 < 2 );
|
||||
BOOST_CHECK( l1 <= l2 );
|
||||
BOOST_CHECK( 1 <= l2 );
|
||||
BOOST_CHECK( l1 <= l );
|
||||
BOOST_CHECK( l <= l2 );
|
||||
BOOST_CHECK( 2 <= l2 );
|
||||
BOOST_CHECK( l <= 2 );
|
||||
BOOST_CHECK( l2 > l1 );
|
||||
BOOST_CHECK( 2 > l1 );
|
||||
BOOST_CHECK( l2 > 1 );
|
||||
BOOST_CHECK( l2 >= l1 );
|
||||
BOOST_CHECK( 2 >= l1 );
|
||||
BOOST_CHECK( l2 >= 1 );
|
||||
BOOST_CHECK( l2 >= l );
|
||||
BOOST_CHECK( 2 >= l );
|
||||
BOOST_CHECK( l2 >= 2 );
|
||||
BOOST_CHECK( static_cast<bool>(l2 == l) );
|
||||
BOOST_CHECK( static_cast<bool>(2 == l) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 == 2) );
|
||||
BOOST_CHECK( static_cast<bool>(l == l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 != l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 != 2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 != l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 < l2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 < l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 < 2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 <= l2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 <= l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l1 <= l) );
|
||||
BOOST_CHECK( static_cast<bool>(l <= l2) );
|
||||
BOOST_CHECK( static_cast<bool>(2 <= l2) );
|
||||
BOOST_CHECK( static_cast<bool>(l <= 2) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 > l1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 > l1) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 > 1) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 >= l1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 >= l1) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 >= 1) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 >= l) );
|
||||
BOOST_CHECK( static_cast<bool>(2 >= l) );
|
||||
BOOST_CHECK( static_cast<bool>(l2 >= 2) );
|
||||
|
||||
cout << "Performed tests on MyShort objects.\n";
|
||||
|
||||
@ -807,37 +851,37 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (di = di2), (di.value() == 2) );
|
||||
|
||||
BOOST_CHECK( di2 == di );
|
||||
BOOST_CHECK( 2 == di );
|
||||
BOOST_CHECK( di == 2 );
|
||||
BOOST_CHECK( di1 < di2 );
|
||||
BOOST_CHECK( 1 < di2 );
|
||||
BOOST_CHECK( di1 <= di2 );
|
||||
BOOST_CHECK( 1 <= di2 );
|
||||
BOOST_CHECK( di2 > di1 );
|
||||
BOOST_CHECK( di2 > 1 );
|
||||
BOOST_CHECK( di2 >= di1 );
|
||||
BOOST_CHECK( di2 >= 1 );
|
||||
BOOST_CHECK( di1 / di2 == half );
|
||||
BOOST_CHECK( di1 / 2 == half );
|
||||
BOOST_CHECK( 1 / di2 == half );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=2) == half) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=di2) == half) );
|
||||
BOOST_CHECK( di1 * di2 == di2 );
|
||||
BOOST_CHECK( di1 * 2 == di2 );
|
||||
BOOST_CHECK( 1 * di2 == di2 );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=2) == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=di2) == di2) );
|
||||
BOOST_CHECK( di2 - di1 == di1 );
|
||||
BOOST_CHECK( di2 - 1 == di1 );
|
||||
BOOST_CHECK( 2 - di1 == di1 );
|
||||
PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=1) == di1) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=di1) == di1) );
|
||||
BOOST_CHECK( di1 + di1 == di2 );
|
||||
BOOST_CHECK( di1 + 1 == di2 );
|
||||
BOOST_CHECK( 1 + di1 == di2 );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=1) == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=di1) == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 == di) );
|
||||
BOOST_CHECK( static_cast<bool>(2 == di) );
|
||||
BOOST_CHECK( static_cast<bool>(di == 2) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 < di2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 < di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 <= di2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 <= di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 > di1) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 > 1) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 >= di1) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 >= 1) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 / di2 == half) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 / 2 == half) );
|
||||
BOOST_CHECK( static_cast<bool>(1 / di2 == half) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=2) == half) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=di2) == half) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 * di2 == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 * 2 == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 * di2 == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=2) == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=di2) == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 - di1 == di1) );
|
||||
BOOST_CHECK( static_cast<bool>(di2 - 1 == di1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 - di1 == di1) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=1) == di1) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=di1) == di1) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 + di1 == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(di1 + 1 == di2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 + di1 == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=1) == di2) );
|
||||
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=di1) == di2) );
|
||||
|
||||
cout << "Performed tests on MyDoubleInt objects.\n";
|
||||
|
||||
@ -854,42 +898,42 @@ test_main( int , char * [] )
|
||||
|
||||
PRIVATE_EXPR_TEST( (li = li2), (li.value() == 2) );
|
||||
|
||||
BOOST_CHECK( li2 == li );
|
||||
BOOST_CHECK( 2 == li );
|
||||
BOOST_CHECK( li == 2 );
|
||||
BOOST_CHECK( li1 < li2 );
|
||||
BOOST_CHECK( 1 < li2 );
|
||||
BOOST_CHECK( li1 <= li2 );
|
||||
BOOST_CHECK( 1 <= li2 );
|
||||
BOOST_CHECK( li2 > li1 );
|
||||
BOOST_CHECK( li2 > 1 );
|
||||
BOOST_CHECK( li2 >= li1 );
|
||||
BOOST_CHECK( li2 >= 1 );
|
||||
BOOST_CHECK( li1 % li2 == li1 );
|
||||
BOOST_CHECK( li1 % 2 == li1 );
|
||||
BOOST_CHECK( 1 % li2 == li1 );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=2) == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=li2) == li1) );
|
||||
BOOST_CHECK( li1 / li2 == 0 );
|
||||
BOOST_CHECK( li1 / 2 == 0 );
|
||||
BOOST_CHECK( 1 / li2 == 0 );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=2) == 0) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=li2) == 0) );
|
||||
BOOST_CHECK( li1 * li2 == li2 );
|
||||
BOOST_CHECK( li1 * 2 == li2 );
|
||||
BOOST_CHECK( 1 * li2 == li2 );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=2) == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=li2) == li2) );
|
||||
BOOST_CHECK( li2 - li1 == li1 );
|
||||
BOOST_CHECK( li2 - 1 == li1 );
|
||||
BOOST_CHECK( 2 - li1 == li1 );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=1) == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=li1) == li1) );
|
||||
BOOST_CHECK( li1 + li1 == li2 );
|
||||
BOOST_CHECK( li1 + 1 == li2 );
|
||||
BOOST_CHECK( 1 + li1 == li2 );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=1) == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=li1) == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 == li) );
|
||||
BOOST_CHECK( static_cast<bool>(2 == li) );
|
||||
BOOST_CHECK( static_cast<bool>(li == 2) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 < li2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 < li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 <= li2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 <= li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 > li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 > 1) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 >= li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 >= 1) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 % li2 == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 % 2 == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(1 % li2 == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=2) == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=li2) == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 / li2 == 0) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 / 2 == 0) );
|
||||
BOOST_CHECK( static_cast<bool>(1 / li2 == 0) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=2) == 0) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=li2) == 0) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 * li2 == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 * 2 == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 * li2 == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=2) == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=li2) == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 - li1 == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li2 - 1 == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(2 - li1 == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=1) == li1) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=li1) == li1) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 + li1 == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(li1 + 1 == li2) );
|
||||
BOOST_CHECK( static_cast<bool>(1 + li1 == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=1) == li2) );
|
||||
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=li1) == li2) );
|
||||
|
||||
cout << "Performed tests on MyLongInt objects.\n";
|
||||
|
||||
|
43
ref_test.cpp
43
ref_test.cpp
@ -68,11 +68,54 @@ struct ref_wrapper
|
||||
}
|
||||
};
|
||||
|
||||
struct copy_counter {
|
||||
static int count_;
|
||||
copy_counter(copy_counter const& /*other*/) {
|
||||
++count_;
|
||||
}
|
||||
copy_counter() {}
|
||||
static void reset() { count_ = 0; }
|
||||
static int count() { return copy_counter::count_; }
|
||||
};
|
||||
|
||||
int copy_counter::count_ = 0;
|
||||
|
||||
} // namespace unnamed
|
||||
|
||||
template <class T>
|
||||
void do_unwrap(T t) {
|
||||
|
||||
/* typename unwrap_reference<T>::type& lt = */
|
||||
unwrap_ref(t);
|
||||
|
||||
}
|
||||
|
||||
void unwrap_test() {
|
||||
|
||||
int i = 3;
|
||||
const int ci = 2;
|
||||
|
||||
do_unwrap(i);
|
||||
do_unwrap(ci);
|
||||
do_unwrap(ref(i));
|
||||
do_unwrap(cref(ci));
|
||||
do_unwrap(ref(ci));
|
||||
|
||||
copy_counter cc;
|
||||
BOOST_CHECK(cc.count() == 0);
|
||||
|
||||
do_unwrap(cc);
|
||||
do_unwrap(ref(cc));
|
||||
do_unwrap(cref(cc));
|
||||
|
||||
BOOST_CHECK(cc.count() == 1);
|
||||
BOOST_CHECK(unwrap_ref(ref(cc)).count() == 1);
|
||||
}
|
||||
|
||||
int test_main(int, char * [])
|
||||
{
|
||||
ref_wrapper<int>::test(1);
|
||||
ref_wrapper<int const>::test(1);
|
||||
unwrap_test();
|
||||
return 0;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ Last modified: Mon Aug 11 11:27:03 EST 2003
|
||||
<p><EFBFBD> Copyright 2003 The Trustees of Indiana University.
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http:www.boost.org/LICENSE_1_0.txt)</p>
|
||||
http://www.boost.org/LICENSE_1_0.txt)</p>
|
||||
|
||||
</body>
|
||||
|
||||
|
98
swap.html
Normal file
98
swap.html
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Boost: Swap Documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Page header -->
|
||||
<h2>
|
||||
<img src="../../boost.png" alt="C++ Boost" align="middle" width="277" height="86"/>
|
||||
Header <<a href="../../boost/swap.hpp">boost/swap.hpp</a>>
|
||||
</h2>
|
||||
|
||||
<h1>Swap</h1>
|
||||
|
||||
<p>
|
||||
<tt>template<class T> void swap(T& <em>left</em>, T& <em>right</em>);</tt>
|
||||
</p>
|
||||
|
||||
<!-- Introduction -->
|
||||
<p>
|
||||
The template function <tt>boost::swap</tt> allows the values of two variables to be swapped, using argument dependent lookup to select a specialized swap function if available. If no specialized swap function is available, <tt>std::swap</tt> is used.
|
||||
</p>
|
||||
|
||||
<!-- Rationale -->
|
||||
<h2>Rationale</h2>
|
||||
<p>
|
||||
The generic <tt>std::swap</tt> function requires that the elements to be swapped are assignable and copy constructible. It is usually implemented using one copy construction and two assignments - this is often both unnecessarily restrictive and unnecessarily slow. In addition, where the generic swap implementation provides only the basic guarantee, specialized swap functions are often able to provide the no-throw exception guarantee (and it is considered best practice to do so where possible<sup><a href="#ref1">1</a></sup>).</p>
|
||||
<p>
|
||||
The alternative to using argument dependent lookup in this situation is to provide a template specialization of <tt>std::swap</tt> for every type that requires a specialized swap. Although this is legal C++, no Boost libraries use this method, whereas many Boost libraries provide specialized swap functions in their own namespaces.
|
||||
</p>
|
||||
<p>
|
||||
<tt>boost::swap</tt> also supports swapping built-in arrays. Note that <tt>std::swap</tt> originally did not do so, but a request to add an overload of <tt>std::swap</tt> for built-in arrays has been accepted by the C++ Standards Committee<sup><a href="#ref2">2</a></sup>.
|
||||
</p>
|
||||
|
||||
<!-- Exception Safety -->
|
||||
<h2>Exception Safety</h2>
|
||||
<p>
|
||||
<tt>boost::swap</tt> provides the same exception guarantee as the underlying swap function used, with one exception; for an array of type <tt>T[n]</tt>, where <tt>n > 1</tt> and the underlying swap function for <tt>T</tt> provides the strong exception guarantee, <tt>boost::swap</tt> provides only the basic exception guarantee.
|
||||
</p>
|
||||
|
||||
<!-- Requirements -->
|
||||
<h2>Requirements</h2>
|
||||
<p>Either:</p>
|
||||
<ul>
|
||||
<li>T must be assignable</li>
|
||||
<li>T must be copy constructible</li>
|
||||
</ul>
|
||||
<p>Or:</p>
|
||||
<ul>
|
||||
<li>A function with the signature <tt>swap(T&,T&)</tt> is available via argument dependent lookup</li>
|
||||
</ul>
|
||||
<p>Or:</p>
|
||||
<ul>
|
||||
<li>A template specialization of <tt>std::swap</tt> exists for T</li>
|
||||
</ul>
|
||||
<p>Or:</p>
|
||||
<ul>
|
||||
<li>T is a built-in array of swappable elements</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<!-- Portability -->
|
||||
<h2>Portability</h2>
|
||||
<p>
|
||||
Several older compilers do not support argument dependent lookup ‒ on these compilers <tt>boost::swap</tt> will call <tt>std::swap</tt>, ignoring any specialized swap functions that could be found as a result of argument dependent lookup.
|
||||
</p>
|
||||
|
||||
<!-- Credits -->
|
||||
<h2>Credits</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<em>Niels Dekker</em> - for implementing and documenting support for built-in arrays
|
||||
</li>
|
||||
<li>
|
||||
<em><a href="mailto:Joseph.Gauterin@googlemail.com">Joseph Gauterin</a></em> - for the initial idea, implementation, tests, and documentation
|
||||
</li>
|
||||
<li>
|
||||
<em>Steven Watanabe</em> - for the idea to make <tt>boost::swap</tt> less specialized than <tt>std::swap</tt>, thereby allowing the function to have the name 'swap' without introducing ambiguity
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- References -->
|
||||
<hr/>
|
||||
<p><sup><a id="ref1"/>[1]</sup>Scott Meyers, Effective C++ Third Edition, Item 25: "Consider support for a non-throwing swap"</p>
|
||||
<p><sup><a id="ref2"/>[2]</sup><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809">LWG Defect Report 809 (std::swap should be overloaded for array types)</a></p>
|
||||
|
||||
<!-- Copyright info -->
|
||||
<hr/>
|
||||
<p>Revised: 08 September 2009</p>
|
||||
<p>
|
||||
Copyright 2007 - 2009 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0.
|
||||
(See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
37
swap/test/Jamfile.v2
Normal file
37
swap/test/Jamfile.v2
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2007, 2008 Joseph Gauterin
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
test-suite utility/swap
|
||||
:
|
||||
[ compile root_header_1.cpp ]
|
||||
[ compile root_header_2.cpp ]
|
||||
[ compile lib_header_1.cpp ]
|
||||
[ compile lib_header_2.cpp ]
|
||||
[ compile mixed_headers_1.cpp ]
|
||||
[ compile mixed_headers_2.cpp ]
|
||||
[ run primitive.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run specialized_in_boost.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run specialized_in_global.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run specialized_in_other.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run specialized_in_std.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run specialized_in_boost_and_other.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_bitset.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_dateorder.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_string.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_typeinfo_ptr.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_vector_of_boost.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_vector_of_global.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run std_vector_of_other.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run no_ambiguity_in_boost.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run array_of_array_of_class.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run array_of_array_of_int.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run array_of_class.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run array_of_int.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
[ run array_of_template.cpp ../../../test/build//boost_test_exec_monitor/<link>static ]
|
||||
;
|
69
swap/test/array_of_array_of_class.cpp
Normal file
69
swap/test/array_of_array_of_class.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
//Provide swap function in both the namespace of swap_test_class
|
||||
//(which is the global namespace), and the std namespace.
|
||||
//It's common to provide a swap function for a class in both
|
||||
//namespaces. Scott Meyers recommends doing so: Effective C++,
|
||||
//Third Edition, item 25, "Consider support for a non-throwing swap".
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
const std::size_t number_of_elements = first_dimension * second_dimension;
|
||||
|
||||
swap_test_class array1[first_dimension][second_dimension];
|
||||
swap_test_class array2[first_dimension][second_dimension];
|
||||
|
||||
swap_test_class* const ptr1 = array1[0];
|
||||
swap_test_class* const ptr2 = array2[0];
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
ptr1[i].set_data( static_cast<int>(i) );
|
||||
ptr2[i].set_data( static_cast<int>(i + number_of_elements) );
|
||||
}
|
||||
|
||||
boost::swap(array1, array2);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(ptr1[i].get_data(), static_cast<int>(i + number_of_elements) );
|
||||
BOOST_CHECK_EQUAL(ptr2[i].get_data(), static_cast<int>(i) );
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), number_of_elements);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
}
|
42
swap/test/array_of_array_of_int.cpp
Normal file
42
swap/test/array_of_array_of_int.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
const std::size_t number_of_elements = first_dimension * second_dimension;
|
||||
|
||||
int array1[first_dimension][second_dimension];
|
||||
int array2[first_dimension][second_dimension];
|
||||
|
||||
int* const ptr1 = array1[0];
|
||||
int* const ptr2 = array2[0];
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
ptr1[i] = static_cast<int>(i);
|
||||
ptr2[i] = static_cast<int>(i + number_of_elements);
|
||||
}
|
||||
|
||||
boost::swap(array1, array2);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(ptr1[i], static_cast<int>(i + number_of_elements) );
|
||||
BOOST_CHECK_EQUAL(ptr2[i], static_cast<int>(i) );
|
||||
}
|
||||
return 0;
|
||||
}
|
61
swap/test/array_of_class.cpp
Normal file
61
swap/test/array_of_class.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
//Provide swap function in both the namespace of swap_test_class
|
||||
//(which is the global namespace), and the std namespace.
|
||||
//It's common to provide a swap function for a class in both
|
||||
//namespaces. Scott Meyers recommends doing so: Effective C++,
|
||||
//Third Edition, item 25, "Consider support for a non-throwing swap".
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_class initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
const swap_test_class initial_array2[array_size] = { swap_test_class(3), swap_test_class(4) };
|
||||
|
||||
swap_test_class array1[array_size];
|
||||
swap_test_class array2[array_size];
|
||||
|
||||
std::copy(initial_array1, initial_array1 + array_size, array1);
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
}
|
35
swap/test/array_of_int.cpp
Normal file
35
swap/test/array_of_int.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::size_t array_size = 3;
|
||||
const int initial_array1[array_size] = { 1, 2, 3 };
|
||||
const int initial_array2[array_size] = { 4, 5, 6 };
|
||||
|
||||
int array1[array_size];
|
||||
int array2[array_size];
|
||||
|
||||
std::copy(initial_array1, initial_array1 + array_size, array1);
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
boost::swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
return 0;
|
||||
}
|
71
swap/test/array_of_template.cpp
Normal file
71
swap/test/array_of_template.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of swap_test_template<int> objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
template <class T>
|
||||
class swap_test_template
|
||||
{
|
||||
public:
|
||||
typedef T template_argument;
|
||||
swap_test_class swap_test_object;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline bool operator==(const swap_test_template<T> & lhs, const swap_test_template<T> & rhs)
|
||||
{
|
||||
return lhs.swap_test_object == rhs.swap_test_object;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool operator!=(const swap_test_template<T> & lhs, const swap_test_template<T> & rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
//Provide swap function in the namespace of swap_test_template
|
||||
//(which is the global namespace). Note that it isn't allowed to put
|
||||
//an overload of this function within the std namespace.
|
||||
template <class T>
|
||||
void swap(swap_test_template<T>& left, swap_test_template<T>& right)
|
||||
{
|
||||
left.swap_test_object.swap(right.swap_test_object);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_template<int> initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
const swap_test_template<int> initial_array2[array_size] = { swap_test_class(3), swap_test_class(4) };
|
||||
|
||||
swap_test_template<int> array1[array_size];
|
||||
swap_test_template<int> array2[array_size];
|
||||
|
||||
std::copy(initial_array1, initial_array1 + array_size, array1);
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
}
|
10
swap/test/lib_header_1.cpp
Normal file
10
swap/test/lib_header_1.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap header compiles as a standalone translation unit
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
|
11
swap/test/lib_header_2.cpp
Normal file
11
swap/test/lib_header_2.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap header include guards work correctly
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
|
11
swap/test/mixed_headers_1.cpp
Normal file
11
swap/test/mixed_headers_1.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap headers work when both are included
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
|
12
swap/test/mixed_headers_2.cpp
Normal file
12
swap/test/mixed_headers_2.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap headers work when both are included
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
|
44
swap/test/no_ambiguity_in_boost.cpp
Normal file
44
swap/test/no_ambiguity_in_boost.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// boost::swap internally does an unqualified function call to swap.
|
||||
// This could have led to ambiguity or infinite recursion, when the
|
||||
// objects to be swapped would themselves be from the boost namespace.
|
||||
// If so, boost::swap itself might be found by argument dependent lookup.
|
||||
// The implementation of boost::swap resolves this issue by giving
|
||||
// boost::swap two template argumetns, thereby making it less specialized
|
||||
// than std::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
|
||||
boost::swap_test_class object1 = initial_value1;
|
||||
boost::swap_test_class object2 = initial_value2;
|
||||
|
||||
boost::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
23
swap/test/primitive.cpp
Normal file
23
swap/test/primitive.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
int object1 = 1;
|
||||
int object2 = 2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,2);
|
||||
BOOST_CHECK_EQUAL(object2,1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
10
swap/test/root_header_1.cpp
Normal file
10
swap/test/root_header_1.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap header compiles as a standalone translation unit
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
|
11
swap/test/root_header_2.cpp
Normal file
11
swap/test/root_header_2.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that the swap header include guards work correctly
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
45
swap/test/specialized_in_boost.cpp
Normal file
45
swap/test/specialized_in_boost.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
//Provide swap function in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
|
||||
boost::swap_test_class object1 = initial_value1;
|
||||
boost::swap_test_class object2 = initial_value2;
|
||||
|
||||
boost::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
64
swap/test/specialized_in_boost_and_other.cpp
Normal file
64
swap/test/specialized_in_boost_and_other.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests whether instances of a class from a namespace other than boost are
|
||||
// properly swapped, when both boost and the other namespace have a custom
|
||||
// swap function for that class. Note that it shouldn't be necessary for a class
|
||||
// in an other namespace to have a custom swap function in boost, because the
|
||||
// boost::swap utility should find the swap function in the other namespace, by
|
||||
// argument dependent lookup (ADL). Unfortunately ADL isn't fully implemented
|
||||
// by some specific compiler versions, including Intel C++ 8.1, MSVC 7.1, and
|
||||
// Borland 5.9.3. Users of those compilers might consider adding a swap overload
|
||||
// to the boost namespace.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
//Provide swap function in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
void swap(::other::swap_test_class& left, ::other::swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
//Provide swap function in namespace other
|
||||
namespace other
|
||||
{
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
|
||||
other::swap_test_class object1 = initial_value1;
|
||||
other::swap_test_class object2 = initial_value2;
|
||||
|
||||
other::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
39
swap/test/specialized_in_global.cpp
Normal file
39
swap/test/specialized_in_global.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
//Provide swap function in gloabl namespace
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
|
||||
swap_test_class object1 = initial_value1;
|
||||
swap_test_class object2 = initial_value2;
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
45
swap/test/specialized_in_other.cpp
Normal file
45
swap/test/specialized_in_other.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
//Provide swap function in namespace other
|
||||
namespace other
|
||||
{
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
|
||||
other::swap_test_class object1 = initial_value1;
|
||||
other::swap_test_class object2 = initial_value2;
|
||||
|
||||
other::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
44
swap/test/specialized_in_std.cpp
Normal file
44
swap/test/specialized_in_std.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
|
||||
//Provide swap function in namespace std
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
|
||||
swap_test_class object1 = initial_value1;
|
||||
swap_test_class object2 = initial_value2;
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
33
swap/test/std_bitset.cpp
Normal file
33
swap/test/std_bitset.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2008 - 2010 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::bitset<T> objects by means of boost::swap.
|
||||
// Unlike most other Standard C++ Library template classes,
|
||||
// std::bitset<T> does not have its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <bitset>
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
typedef std::bitset<8> bitset_type;
|
||||
const bitset_type initial_value1 = 1;
|
||||
const bitset_type initial_value2 = 2;
|
||||
|
||||
bitset_type object1 = initial_value1;
|
||||
bitset_type object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
32
swap/test/std_dateorder.cpp
Normal file
32
swap/test/std_dateorder.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::time_base::dateorder objects by means of boost::swap.
|
||||
// std::time_base::dateorder is an enumerated type. It does not have an
|
||||
// std::swap overload or template specialization.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <locale>
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::time_base::dateorder initial_value1 = std::time_base::dmy;
|
||||
const std::time_base::dateorder initial_value2 = std::time_base::mdy;
|
||||
|
||||
std::time_base::dateorder object1 = initial_value1;
|
||||
std::time_base::dateorder object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
31
swap/test/std_string.cpp
Normal file
31
swap/test/std_string.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::string objects by means of boost::swap.
|
||||
// std::string has its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::string initial_value1 = "one";
|
||||
const std::string initial_value2 = "two";
|
||||
|
||||
std::string object1 = initial_value1;
|
||||
std::string object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
32
swap/test/std_typeinfo_ptr.cpp
Normal file
32
swap/test/std_typeinfo_ptr.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::type_info pointers by means of boost::swap.
|
||||
// There is no std::swap overload or template specialization
|
||||
// for std::type_info pointers.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
const std::type_info * const initial_value1 = 0;
|
||||
const std::type_info * const initial_value2 = &typeid(double);
|
||||
|
||||
const std::type_info * ptr1 = initial_value1;
|
||||
const std::type_info * ptr2 = initial_value2;
|
||||
|
||||
boost::swap(ptr1,ptr2);
|
||||
|
||||
BOOST_CHECK_EQUAL(ptr1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(ptr2,initial_value1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
60
swap/test/std_vector_of_boost.cpp
Normal file
60
swap/test/std_vector_of_boost.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// having boost::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
//Provide swap function in namespace boost
|
||||
namespace boost
|
||||
{
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
typedef boost::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
|
||||
const vector_type::size_type initial_size1 = 1;
|
||||
const vector_type::size_type initial_size2 = 2;
|
||||
|
||||
const vector_type initial_value1(initial_size1, swap_test_class_type(1));
|
||||
const vector_type initial_value2(initial_size2, swap_test_class_type(2));
|
||||
|
||||
vector_type object1 = initial_value1;
|
||||
vector_type object2 = initial_value2;
|
||||
|
||||
swap_test_class_type::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
53
swap/test/std_vector_of_global.cpp
Normal file
53
swap/test/std_vector_of_global.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// having ::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
//Provide swap function in the global namespace
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
typedef std::vector<swap_test_class> vector_type;
|
||||
|
||||
const vector_type::size_type initial_size1 = 1;
|
||||
const vector_type::size_type initial_size2 = 2;
|
||||
|
||||
const vector_type initial_value1(initial_size1, swap_test_class(1));
|
||||
const vector_type initial_value2(initial_size2, swap_test_class(2));
|
||||
|
||||
vector_type object1 = initial_value1;
|
||||
vector_type object2 = initial_value2;
|
||||
|
||||
swap_test_class::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
60
swap/test/std_vector_of_other.cpp
Normal file
60
swap/test/std_vector_of_other.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// having other::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
{
|
||||
#include "./swap_test_class.hpp"
|
||||
}
|
||||
|
||||
//Provide swap function in namespace other
|
||||
namespace other
|
||||
{
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
typedef other::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
|
||||
const vector_type::size_type initial_size1 = 1;
|
||||
const vector_type::size_type initial_size2 = 2;
|
||||
|
||||
const vector_type initial_value1(initial_size1, swap_test_class_type(1));
|
||||
const vector_type initial_value2(initial_size2, swap_test_class_type(2));
|
||||
|
||||
vector_type object1 = initial_value1;
|
||||
vector_type object2 = initial_value2;
|
||||
|
||||
swap_test_class_type::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
114
swap/test/swap_test_class.hpp
Normal file
114
swap/test/swap_test_class.hpp
Normal file
@ -0,0 +1,114 @@
|
||||
// Copyright (c) 2007-2008 Joseph Gauterin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests class used by the Boost.Swap tests
|
||||
|
||||
#ifndef BOOST_UTILITY_SWAP_TEST_CLASS_HPP
|
||||
#define BOOST_UTILITY_SWAP_TEST_CLASS_HPP
|
||||
|
||||
|
||||
class swap_test_class
|
||||
{
|
||||
int m_data;
|
||||
public:
|
||||
explicit swap_test_class(int arg = 0)
|
||||
:
|
||||
m_data(arg)
|
||||
{
|
||||
++constructCount();
|
||||
}
|
||||
|
||||
~swap_test_class()
|
||||
{
|
||||
++destructCount();
|
||||
}
|
||||
|
||||
swap_test_class(const swap_test_class& arg)
|
||||
:
|
||||
m_data(arg.m_data)
|
||||
{
|
||||
++copyCount();
|
||||
++destructCount();
|
||||
}
|
||||
|
||||
swap_test_class& operator=(const swap_test_class& arg)
|
||||
{
|
||||
m_data = arg.m_data;
|
||||
++copyCount();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(swap_test_class& other)
|
||||
{
|
||||
const int temp = m_data;
|
||||
m_data = other.m_data;
|
||||
other.m_data = temp;
|
||||
|
||||
++swapCount();
|
||||
}
|
||||
|
||||
int get_data() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void set_data(int arg)
|
||||
{
|
||||
m_data = arg;
|
||||
}
|
||||
|
||||
static unsigned int swap_count(){ return swapCount(); }
|
||||
static unsigned int copy_count(){ return copyCount(); }
|
||||
static unsigned int construct_count(){ return constructCount(); }
|
||||
static unsigned int destruct_count(){ return destructCount(); }
|
||||
|
||||
static void reset()
|
||||
{
|
||||
swapCount() = 0;
|
||||
copyCount() = 0;
|
||||
constructCount() = 0;
|
||||
destructCount() = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static unsigned int& swapCount()
|
||||
{
|
||||
static unsigned int value = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
static unsigned int& copyCount()
|
||||
{
|
||||
static unsigned int value = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
static unsigned int& constructCount()
|
||||
{
|
||||
static unsigned int value = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
static unsigned int& destructCount()
|
||||
{
|
||||
static unsigned int value = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline bool operator==(const swap_test_class & lhs, const swap_test_class & rhs)
|
||||
{
|
||||
return lhs.get_data() == rhs.get_data();
|
||||
}
|
||||
|
||||
inline bool operator!=(const swap_test_class & lhs, const swap_test_class & rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,8 +1,7 @@
|
||||
# Copyright David Abrahams 2003. Permission to copy, use,
|
||||
# modify, sell and distribute this software is granted provided this
|
||||
# copyright notice appears in all copies. This software is provided
|
||||
# "as is" without express or implied warranty, and with no claim as
|
||||
# to its suitability for any purpose.
|
||||
# Copyright David Abrahams 2003.
|
||||
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
# For more information, see http://www.boost.org/
|
||||
|
||||
@ -12,10 +11,13 @@ import testing ;
|
||||
# Please keep the tests ordered by filename
|
||||
test-suite utility
|
||||
:
|
||||
[ run ../addressof_fn_test.cpp ]
|
||||
[ run ../addressof_test.cpp ]
|
||||
[ run ../addressof_test2.cpp ]
|
||||
[ 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 ]
|
||||
@ -30,7 +32,13 @@ test-suite utility
|
||||
[ compile result_of_test.cpp ]
|
||||
[ run ../shared_iterator_test.cpp ]
|
||||
[ run ../value_init_test.cpp ]
|
||||
[ run ../value_init_workaround_test.cpp ]
|
||||
[ run ../initialized_test.cpp ]
|
||||
[ compile-fail ../value_init_test_fail1.cpp ]
|
||||
[ compile-fail ../value_init_test_fail2.cpp ]
|
||||
[ compile-fail ../value_init_test_fail3.cpp ]
|
||||
[ compile-fail ../initialized_test_fail1.cpp ]
|
||||
[ compile-fail ../initialized_test_fail2.cpp ]
|
||||
[ run ../verify_test.cpp ]
|
||||
;
|
||||
|
||||
|
0
test/next_prior_test.cpp
Executable file → Normal file
0
test/next_prior_test.cpp
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user