summaryrefslogtreecommitdiff
path: root/libs/utility
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utility')
-rw-r--r--libs/utility/OptionalPointee.html11
-rw-r--r--libs/utility/addressof_fn_test.cpp76
-rw-r--r--libs/utility/addressof_test.cpp94
-rw-r--r--libs/utility/addressof_test2.cpp95
-rw-r--r--libs/utility/assert.html115
-rw-r--r--libs/utility/assert_test.cpp153
-rw-r--r--libs/utility/base_from_member.html371
-rw-r--r--libs/utility/base_from_member_ref_test.cpp29
-rw-r--r--libs/utility/binary_search_test.cpp258
-rw-r--r--libs/utility/call_traits_test.cpp8
-rw-r--r--libs/utility/checked_delete.html133
-rw-r--r--libs/utility/checked_delete_test.cpp28
-rw-r--r--libs/utility/compressed_pair.htm88
-rw-r--r--libs/utility/current_function.html36
-rw-r--r--libs/utility/current_function_test.cpp40
-rw-r--r--libs/utility/doc/Jamfile.v265
-rw-r--r--libs/utility/doc/base_from_member.qbk363
-rw-r--r--libs/utility/doc/compressed_pair.qbk99
-rw-r--r--libs/utility/doc/declval.qbk1
-rw-r--r--libs/utility/doc/html/base_from_member.html437
-rw-r--r--libs/utility/doc/html/compressed_pair.html155
-rw-r--r--libs/utility/doc/html/declval.html44
-rw-r--r--libs/utility/doc/html/standalone_base_from_member_HTML.manifest1
-rw-r--r--libs/utility/doc/html/standalone_compressed_pair_HTML.manifest1
-rw-r--r--libs/utility/doc/html/standalone_declval_HTML.manifest1
-rw-r--r--libs/utility/doc/html/standalone_string_ref_HTML.manifest1
-rw-r--r--libs/utility/doc/html/string_ref.html280
-rw-r--r--libs/utility/doc/string_ref.qbk167
-rw-r--r--libs/utility/enable_if.html479
-rw-r--r--libs/utility/enable_if/test/Jamfile.v223
-rw-r--r--libs/utility/enable_if/test/constructors.cpp62
-rw-r--r--libs/utility/enable_if/test/dummy_arg_disambiguation.cpp46
-rw-r--r--libs/utility/enable_if/test/lazy.cpp82
-rw-r--r--libs/utility/enable_if/test/lazy_test.cpp100
-rw-r--r--libs/utility/enable_if/test/member_templates.cpp43
-rw-r--r--libs/utility/enable_if/test/namespace_disambiguation.cpp47
-rw-r--r--libs/utility/enable_if/test/no_disambiguation.cpp43
-rw-r--r--libs/utility/enable_if/test/partial_specializations.cpp67
-rw-r--r--libs/utility/generator_iterator_test.cpp63
-rw-r--r--libs/utility/in_place_factories.html2
-rw-r--r--libs/utility/index.html26
-rw-r--r--libs/utility/meta/libraries.json113
-rw-r--r--libs/utility/noncopyable_test.cpp36
-rw-r--r--libs/utility/numeric_traits_test.cpp9
-rw-r--r--libs/utility/ref_ct_test.cpp134
-rw-r--r--libs/utility/ref_test.cpp121
-rw-r--r--libs/utility/swap.html98
-rw-r--r--libs/utility/swap/test/Jamfile.v237
-rw-r--r--libs/utility/swap/test/array_of_array_of_class.cpp69
-rw-r--r--libs/utility/swap/test/array_of_array_of_int.cpp42
-rw-r--r--libs/utility/swap/test/array_of_class.cpp61
-rw-r--r--libs/utility/swap/test/array_of_int.cpp35
-rw-r--r--libs/utility/swap/test/array_of_template.cpp71
-rw-r--r--libs/utility/swap/test/lib_header_1.cpp10
-rw-r--r--libs/utility/swap/test/lib_header_2.cpp11
-rw-r--r--libs/utility/swap/test/mixed_headers_1.cpp11
-rw-r--r--libs/utility/swap/test/mixed_headers_2.cpp12
-rw-r--r--libs/utility/swap/test/no_ambiguity_in_boost.cpp44
-rw-r--r--libs/utility/swap/test/primitive.cpp23
-rw-r--r--libs/utility/swap/test/root_header_1.cpp10
-rw-r--r--libs/utility/swap/test/root_header_2.cpp11
-rw-r--r--libs/utility/swap/test/specialized_in_boost.cpp45
-rw-r--r--libs/utility/swap/test/specialized_in_boost_and_other.cpp64
-rw-r--r--libs/utility/swap/test/specialized_in_global.cpp39
-rw-r--r--libs/utility/swap/test/specialized_in_other.cpp45
-rw-r--r--libs/utility/swap/test/specialized_in_std.cpp44
-rw-r--r--libs/utility/swap/test/std_bitset.cpp33
-rw-r--r--libs/utility/swap/test/std_dateorder.cpp32
-rw-r--r--libs/utility/swap/test/std_string.cpp31
-rw-r--r--libs/utility/swap/test/std_typeinfo_ptr.cpp32
-rw-r--r--libs/utility/swap/test/std_vector_of_boost.cpp60
-rw-r--r--libs/utility/swap/test/std_vector_of_global.cpp53
-rw-r--r--libs/utility/swap/test/std_vector_of_other.cpp60
-rw-r--r--libs/utility/swap/test/swap_test_class.hpp114
-rw-r--r--libs/utility/test/Jamfile.v222
-rw-r--r--libs/utility/test/next_prior_test.cpp18
-rw-r--r--libs/utility/test/result_of_test.cpp158
-rw-r--r--libs/utility/test/string_ref_test1.cpp109
-rw-r--r--libs/utility/test/string_ref_test2.cpp318
-rw-r--r--libs/utility/test/string_ref_test_io.cpp183
-rw-r--r--libs/utility/utility.htm516
-rw-r--r--libs/utility/value_init.htm17
-rw-r--r--libs/utility/value_init_test.cpp87
-rw-r--r--libs/utility/verify_test.cpp126
84 files changed, 3074 insertions, 4323 deletions
diff --git a/libs/utility/OptionalPointee.html b/libs/utility/OptionalPointee.html
index 462d6f3335..c3c7e44eb6 100644
--- a/libs/utility/OptionalPointee.html
+++ b/libs/utility/OptionalPointee.html
@@ -57,10 +57,7 @@ aliasing.
</TR>
<TR>
<TD VAlign=top>Validity Test</TD>
- <TD VAlign=top>&nbsp;<tt>t</tt><br>
- &nbsp;<tt>t != 0</tt><br>
- &nbsp;<tt>!!t</tt>
- </TD>
+ <TD VAlign=top>&nbsp;<tt>bool(t)</tt></TD>
<TD VAlign=top>&nbsp;bool </TD>
<TD VAlign=top>If the pointee is valid returns true.<br>
If the pointee is invalid returns false.</TD>
@@ -68,9 +65,7 @@ aliasing.
</TR>
<TR>
<TD VAlign=top>Invalidity Test</TD>
- <TD VAlign=top>&nbsp;<tt>t == 0</tt><br>
- &nbsp;<tt>!t</tt>
- </TD>
+ <TD VAlign=top>&nbsp;<tt>!t</tt></TD>
<TD VAlign=top>&nbsp;bool </TD>
<TD VAlign=top>If the pointee is valid returns false.<br>
If the pointee is invalid returns true.</TD>
@@ -161,4 +156,4 @@ so direct usage of relational operators with the implied aliasing of shallow sem
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</BODY>
-</HTML> \ No newline at end of file
+</HTML>
diff --git a/libs/utility/addressof_fn_test.cpp b/libs/utility/addressof_fn_test.cpp
deleted file mode 100644
index 0d043bf412..0000000000
--- a/libs/utility/addressof_fn_test.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#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();
-}
diff --git a/libs/utility/addressof_test.cpp b/libs/utility/addressof_test.cpp
deleted file mode 100644
index 9619cc3a76..0000000000
--- a/libs/utility/addressof_test.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (C) 2002 Brad King (brad.king@kitware.com)
-// Douglas Gregor (gregod@cs.rpi.edu)
-//
-// 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 );
-}
-
-struct addressable
-{
- addressable( int = 0 )
- {
- }
-};
-
-struct useless_type {};
-
-class nonaddressable {
-public:
-
- nonaddressable( int = 0 )
- {
- }
-
- void dummy(); // Silence GCC warning: all member of class are private
-
-private:
-
- useless_type operator&() const;
-};
-
-int main()
-{
- scalar_test<char>();
- scalar_test<int>();
- scalar_test<addressable>();
- scalar_test<nonaddressable>();
-
- array_test<char>();
- array_test<int>();
- array_test<addressable>();
- array_test<nonaddressable>();
-
- return boost::report_errors();
-}
diff --git a/libs/utility/addressof_test2.cpp b/libs/utility/addressof_test2.cpp
deleted file mode 100644
index b1c36f8222..0000000000
--- a/libs/utility/addressof_test2.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// 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();
-}
diff --git a/libs/utility/assert.html b/libs/utility/assert.html
deleted file mode 100644
index 5f3f6e7642..0000000000
--- a/libs/utility/assert.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
- <head>
- <title>Boost: assert.hpp documentation</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
- <table border="0" width="100%">
- <tr>
- <td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A>
- </td>
- <td align="center">
- <h1>assert.hpp</h1>
- </td>
- </tr>
- <tr>
- <td colspan="2" height="64">&nbsp;</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>&lt;boost/assert.hpp&gt;</STRONG> defines the macro <b>BOOST_ASSERT</b>,
- which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG>&lt;cassert&gt;</STRONG>.
- 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>If the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG>&lt;boost/assert.hpp&gt;</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>If the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</STRONG>
- as</P>
- <blockquote>
- <pre>namespace boost
-{
- 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>&lt;cassert&gt;</STRONG>, <STRONG>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</STRONG> defines the macro <b>BOOST_ASSERT_MSG</b>,
- which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG>&lt;cassert&gt;</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>&lt;boost/assert.hpp&gt;</STRONG>
- to specify a different output stream.&nbsp; </P>
- <P>If the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</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>&lt;cassert&gt;</STRONG>, <STRONG>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</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 © 2002, 2007 by Peter Dimov.&nbsp; Copyright © 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> \ No newline at end of file
diff --git a/libs/utility/assert_test.cpp b/libs/utility/assert_test.cpp
deleted file mode 100644
index 26051acc34..0000000000
--- a/libs/utility/assert_test.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-// 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
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/assert.hpp>
-
-void test_default()
-{
- int x = 1;
-
- BOOST_ASSERT(1);
- 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
-#include <boost/assert.hpp>
-
-void test_disabled()
-{
- int x = 1;
-
- BOOST_ASSERT(1);
- 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");
-
- 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;
- p = &p;
-}
-
-#undef BOOST_DISABLE_ASSERTS
-
-#define BOOST_ENABLE_ASSERT_HANDLER
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#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)
-{
-#if !defined(BOOST_NO_STDC_NAMESPACE)
- using std::printf;
-#endif
-
- printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line);
- ++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()");
- }
-};
-
-void test_handler()
-{
- int x = 1;
-
- BOOST_ASSERT(1);
- BOOST_ASSERT(x);
- 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()
-{
- test_default();
- test_disabled();
- test_handler();
-
- return boost::report_errors();
-}
diff --git a/libs/utility/base_from_member.html b/libs/utility/base_from_member.html
deleted file mode 100644
index 21ee6d2347..0000000000
--- a/libs/utility/base_from_member.html
+++ /dev/null
@@ -1,371 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<title>Boost: Base-from-Member Idiom Documentation</title>
-</head>
-
-<body bgcolor="white" link="blue" text="black" vlink="purple" alink="red">
-<h1><img src="../../boost.png" alt="C++ Boost" align="middle"
-width="277" height="86">Base-from-Member Idiom</h1>
-
-<p>The class template <code>boost::base_from_member</code> provides
-a workaround for a class that needs to initialize a base class with a
-member. The class template is in <cite><a
-href="../../boost/utility/base_from_member.hpp">boost/utility/base_from_member.hpp</a></cite>
-which is included in <i><a href="../../boost/utility.hpp">boost/utility.hpp</a></i>.</p>
-
-<p>There is test/example code in <cite><a
-href="base_from_member_test.cpp">base_from_member_test.cpp</a></cite>.</p>
-
-<h2><a name="contents">Contents</a></h2>
-
-<ul>
- <li><a href="#contents">Contents</a></li>
- <li><a href="#rationale">Rationale</a></li>
- <li><a href="#synopsis">Synopsis</a></li>
- <li><a href="#usage">Usage</a></li>
- <li><a href="#example">Example</a></li>
- <li><a href="#credits">Credits</a>
- <ul>
- <li><a href="#contributors">Contributors</a></li>
- </ul></li>
-</ul>
-
-<h2><a name="rationale">Rationale</a></h2>
-
-<p>When developing a class, sometimes a base class needs to be
-initialized with a member of the current class. As a na&iuml;ve
-example:</p>
-
-<blockquote><pre>
-#include &lt;streambuf&gt; <i>// for std::streambuf</i>
-#include &lt;ostream&gt; <i>// for std::ostream</i>
-
-class fdoutbuf
- : public std::streambuf
-{
-public:
- explicit fdoutbuf( int fd );
- //...
-};
-
-class fdostream
- : public std::ostream
-{
-protected:
- fdoutbuf buf;
-public:
- explicit fdostream( int fd )
- : buf( fd ), std::ostream( &amp;buf )
- {}
- //...
-};
-</pre></blockquote>
-
-<p>This is undefined because C++'s initialization order mandates that
-the base class is initialized before the member it uses. <a
-href="http://www.moocat.org">R. Samuel Klatchko</a> developed a way
-around this by using the initialization order in his favor. Base
-classes are intialized in order of declaration, so moving the desired
-member to another base class, that is initialized before the desired
-base class, can ensure proper initialization.</p>
-
-<p>A custom base class can be made for this idiom:</p>
-
-<blockquote><pre>
-#include &lt;streambuf&gt; <i>// for std::streambuf</i>
-#include &lt;ostream&gt; <i>// for std::ostream</i>
-
-class fdoutbuf
- : public std::streambuf
-{
-public:
- explicit fdoutbuf( int fd );
- //...
-};
-
-struct fdostream_pbase
-{
- fdoutbuf sbuffer;
-
- explicit fdostream_pbase( int fd )
- : sbuffer( fd )
- {}
-};
-
-class fdostream
- : private fdostream_pbase
- , public std::ostream
-{
- typedef fdostream_pbase pbase_type;
- typedef std::ostream base_type;
-
-public:
- explicit fdostream( int fd )
- : pbase_type( fd ), base_type( &amp;sbuffer )
- {}
- //...
-};
-</pre></blockquote>
-
-<p>Other projects can use similar custom base classes. The technique
-is basic enough to make a template, with a sample template class in
-this library. The main template parameter is the type of the enclosed
-member. The template class has several (explicit) constructor member
-templates, which implicitly type the constructor arguments and pass them
-to the member. The template class uses implicit copy construction and
-assignment, cancelling them if the enclosed member is non-copyable.</p>
-
-<p>Manually coding a base class may be better if the construction
-and/or copying needs are too complex for the supplied template class,
-or if the compiler is not advanced enough to use it.</p>
-
-<p>Since base classes are unnamed, a class cannot have multiple (direct)
-base classes of the same type. The supplied template class has an
-extra template parameter, an integer, that exists solely to provide type
-differentiation. This parameter has a default value so a single use of a
-particular member type does not need to concern itself with the integer.</p>
-
-<h2><a name="synopsis">Synopsis</a></h2>
-
-<blockquote><pre>
-#ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY
-#define BOOST_BASE_FROM_MEMBER_MAX_ARITY 10
-#endif
-
-template &lt; typename MemberType, int UniqueID = 0 &gt;
-class boost::base_from_member
-{
-protected:
- MemberType member;
-
- base_from_member();
-
- template&lt; typename T1 &gt;
- explicit base_from_member( T1 x1 );
-
- template&lt; typename T1, typename T2 &gt;
- base_from_member( T1 x1, T2 x2 );
-
- //...
-
- template&lt; typename T1, typename T2, typename T3, typename T4,
- typename T5, typename T6, typename T7, typename T8, typename T9,
- typename T10 &gt;
- base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7,
- T8 x8, T9 x9, T10 x10 );
-};
-</pre></blockquote>
-
-<p>The class template has a first template parameter
-<var>MemberType</var> representing the type of the based-member.
-It has a last template parameter <var>UniqueID</var>, that is an
-<code>int</code>, to differentiate between multiple base classes that use
-the same based-member type. The last template parameter has a default
-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
-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>
-
-<p>The <var>BOOST_BASE_FROM_MEMBER_MAX_ARITY</var> macro constant specifies
-the maximum argument length for the constructor templates. The constant
-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>
-
-<h2><a name="usage">Usage</a></h2>
-
-<p>With the starting example, the <code>fdoutbuf</code> sub-object needs
-to be encapsulated in a base class that is inheirited before
-<code>std::ostream</code>.</p>
-
-<blockquote><pre>
-#include &lt;boost/utility/base_from_member.hpp&gt;
-
-#include &lt;streambuf&gt; <i>// for std::streambuf</i>
-#include &lt;ostream&gt; <i>// for std::ostream</i>
-
-class fdoutbuf
- : public std::streambuf
-{
-public:
- explicit fdoutbuf( int fd );
- //...
-};
-
-class fdostream
- : private boost::base_from_member&lt;fdoutbuf&gt;
- , public std::ostream
-{
- // Helper typedef's
- typedef boost::base_from_member&lt;fdoutbuf&gt; pbase_type;
- typedef std::ostream base_type;
-
-public:
- explicit fdostream( int fd )
- : pbase_type( fd ), base_type( &amp;member )
- {}
- //...
-};
-</pre></blockquote>
-
-<p>The base-from-member idiom is an implementation detail, so it
-should not be visible to the clients (or any derived classes) of
-<code>fdostream</code>. Due to the initialization order, the
-<code>fdoutbuf</code> sub-object will get initialized before the
-<code>std::ostream</code> sub-object does, making the former
-sub-object safe to use in the latter sub-object's construction. Since the
-<code>fdoutbuf</code> sub-object of the final type is the only sub-object
-with the name &quot;member,&quot; that name can be used
-unqualified within the final class.</p>
-
-<h2><a name="example">Example</a></h2>
-
-<p>The base-from-member class templates should commonly involve
-only one base-from-member sub-object, usually for attaching a
-stream-buffer to an I/O stream. The next example demonstrates how
-to use multiple base-from-member sub-objects and the resulting
-qualification issues.</p>
-
-<blockquote><pre>
-#include &lt;boost/utility/base_from_member.hpp&gt;
-
-#include &lt;cstddef&gt; <i>// for NULL</i>
-
-struct an_int
-{
- int y;
-
- an_int( float yf );
-};
-
-class switcher
-{
-public:
- switcher();
- switcher( double, int * );
- //...
-};
-
-class flow_regulator
-{
-public:
- flow_regulator( switcher &amp;, switcher &amp; );
- //...
-};
-
-template &lt; unsigned Size &gt;
-class fan
-{
-public:
- explicit fan( switcher );
- //...
-};
-
-class system
- : private boost::base_from_member&lt;an_int&gt;
- , private boost::base_from_member&lt;switcher&gt;
- , private boost::base_from_member&lt;switcher, 1&gt;
- , private boost::base_from_member&lt;switcher, 2&gt;
- , protected flow_regulator
- , public fan&lt;6&gt;
-{
- // Helper typedef's
- typedef boost::base_from_member&lt;an_int&gt; pbase0_type;
- typedef boost::base_from_member&lt;switcher&gt; pbase1_type;
- typedef boost::base_from_member&lt;switcher, 1&gt; pbase2_type;
- typedef boost::base_from_member&lt;switcher, 2&gt; pbase3_type;
-
- typedef flow_regulator base1_type;
- typedef fan&lt;6&gt; base2_type;
-
-public:
- system( double x );
- //...
-};
-
-system::system( double x )
- : pbase0_type( 0.2 )
- , pbase1_type()
- , pbase2_type( -16, &amp;this-&gt;pbase0_type::member )
- , pbase3_type( x, static_cast&lt;int *&gt;(NULL) )
- , base1_type( pbase3_type::member, pbase1_type::member )
- , base2_type( pbase2_type::member )
-{
- //...
-}
-</pre></blockquote>
-
-<p>The final class has multiple sub-objects with the name
-&quot;member,&quot; so any use of that name needs qualification by
-a name of the appropriate base type. (Using <code>typedef</code>s
-ease mentioning the base types.) However, the fix introduces a new
-problem when a pointer is needed. Using the address operator with
-a sub-object qualified with its class's name results in a pointer-to-member
-(here, having a type of <code>an_int boost::base_from_member&lt;an_int,
-0&gt; :: *</code>) instead of a pointer to the member (having a type of
-<code>an_int *</code>). The new problem is fixed by qualifying the
-sub-object with &quot;<code>this-&gt;</code>,&quot; and is needed just
-for pointers, and not for references or values.</p>
-
-<p>There are some argument conversions in the initialization. The
-constructor argument for <code>pbase0_type</code> is converted from
-<code>double</code> to <code>float</code>. The first constructor
-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>
-
-<h2><a name="credits">Credits</a></h2>
-
-<h3><a name="contributors">Contributors</a></h3>
-
-<dl>
- <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
- href="mailto:rsk@moocat.org">rsk@moocat.org</a>, <a
- href="mailto:rsk@brightmail.com">rsk@brightmail.com</a>)
- <dd>Invented the idiom of how to use a class member for initializing
- a base class.
-
- <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>.
-
- <dt>Jonathan Turkanis
- <dd>Supplied an implementation of generating the constructor templates that
- can be controlled and automated with macros. The implementation uses
- the <a href="../preprocessor/index.html">Preprocessor library</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>Copyright 2001, 2003, 2004 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 &lt;<a
-href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>&gt;.)</p>
-
-</body>
-</html>
diff --git a/libs/utility/base_from_member_ref_test.cpp b/libs/utility/base_from_member_ref_test.cpp
new file mode 100644
index 0000000000..fc6f249b3e
--- /dev/null
+++ b/libs/utility/base_from_member_ref_test.cpp
@@ -0,0 +1,29 @@
+//
+// Test that a base_from_member<T&> can be properly constructed
+//
+// Copyright 2014 Agustin Berge
+//
+// 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/base_from_member.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct foo : boost::base_from_member<int&>
+{
+ explicit foo(int& ref) : boost::base_from_member<int&>(ref)
+ {
+ BOOST_TEST(&member == &ref);
+ }
+};
+
+int main()
+{
+ int i = 0;
+ foo f(i);
+
+ return boost::report_errors();
+}
diff --git a/libs/utility/binary_search_test.cpp b/libs/utility/binary_search_test.cpp
deleted file mode 100644
index c17a8590f2..0000000000
--- a/libs/utility/binary_search_test.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-// (C) Copyright David Abrahams 2000.
-// 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 <vector>
-#include <string>
-#include <memory>
-#include <climits>
-#include <iostream>
-#include <cassert>
-#include <stdlib.h> // for rand(). Would use cstdlib but VC6.4 doesn't put it in std::
-#include <list>
-#include <algorithm>
-#include <boost/detail/binary_search.hpp>
-#include <boost/detail/workaround.hpp>
-#include <cstddef>
-
-#if defined(__SGI_STL_PORT) ? defined(__SGI_STL_OWN_IOSTREAMS) : (!defined(__GNUC__) || __GNUC__ > 2)
-# define USE_SSTREAM
-#endif
-
-#ifdef USE_SSTREAM
-# include <sstream>
-#else
-# include <strstream>
-#endif
-
-namespace {
-
-// In order to get ADL to find the comparison operators defined below, they have
-struct mystring : std::string
-{
- typedef std::string base;
-
- mystring(std::string const& x)
- : base(x) {}
-};
-
-typedef std::vector<mystring> string_vector;
-
-const std::size_t sequence_length = 1000;
-
-unsigned random_number()
-{
- return static_cast<unsigned>(::rand()) % sequence_length;
-}
-
-# ifndef USE_SSTREAM
-class unfreezer {
- public:
- unfreezer(std::ostrstream& s) : m_stream(s) {}
- ~unfreezer() { m_stream.freeze(false); }
- private:
- std::ostrstream& m_stream;
-};
-# endif
-
-template <class T>
-void push_back_random_number_string(T& seq)
-{
- unsigned value = random_number();
-# if defined(__SGI_STL_PORT) ? defined(__SGI_STL_OWN_IOSTREAMS) : (!defined(__GNUC__) || __GNUC__ > 2)
- std::ostringstream s;
- s << value;
- seq.push_back(s.str());
-# else
- std::ostrstream s;
- auto unfreezer unfreeze(s);
- s << value << char(0);
- seq.push_back(std::string(s.str()));
-# endif
-}
-
-inline unsigned to_int(unsigned x) { return x; }
-inline unsigned to_int(const std::string& x) { return atoi(x.c_str()); }
-
-struct cmp
-{
- template <class A1, class A2>
- inline bool operator()(const A1& a1, const A2& a2) const
- {
- return to_int(a1) < to_int(a2);
- }
-};
-
-inline bool operator<(const mystring& x, const unsigned y)
-{
- return to_int(x) < y;
-}
-
-inline bool operator<(const unsigned y, const mystring& x)
-{
- return y < to_int(x);
-}
-
-template <class T>
-void sort_by_value(T& x);
-
-template <class T>
-void sort_by_value_(T& v, long)
-{
- std::sort(v.begin(), v.end(), cmp());
-}
-
-template <class T>
-void random_sorted_sequence(T& seq)
-{
- seq.clear();
- for (std::size_t i = 0; i < sequence_length; ++i)
- {
- push_back_random_number_string(seq);
- }
- sort_by_value(seq);
-}
-
-template <class T, class A>
-void sort_by_value_(std::list<T,A>& l, int)
-{
-# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) && !defined(__SGI_STL_PORT)
-// VC6's standard lib doesn't have a template member function for list::sort()
- std::vector<T> seq;
- seq.reserve(sequence_length);
- std::copy(l.begin(), l.end(), std::back_inserter(seq));
- sort_by_value(seq);
- std::copy(seq.begin(), seq.end(), l.begin());
-# else
- l.sort(cmp());
-# endif
-}
-
-template <class T>
-void sort_by_value(T& x)
-{
- (sort_by_value_)(x, 1);
-}
-
-// A way to select the comparisons with/without a Compare parameter for testing.
-template <class Compare> struct searches
-{
- template <class Iterator, class Key>
- static Iterator lower_bound(Iterator start, Iterator finish, Key key, Compare cmp)
- { return boost::detail::lower_bound(start, finish, key, cmp); }
-
- template <class Iterator, class Key>
- static Iterator upper_bound(Iterator start, Iterator finish, Key key, Compare cmp)
- { return boost::detail::upper_bound(start, finish, key, cmp); }
-
- template <class Iterator, class Key>
- static std::pair<Iterator, Iterator> equal_range(Iterator start, Iterator finish, Key key, Compare cmp)
- { return boost::detail::equal_range(start, finish, key, cmp); }
-
- template <class Iterator, class Key>
- static bool binary_search(Iterator start, Iterator finish, Key key, Compare cmp)
- { return boost::detail::binary_search(start, finish, key, cmp); }
-};
-
-struct no_compare {};
-
-template <> struct searches<no_compare>
-{
- template <class Iterator, class Key>
- static Iterator lower_bound(Iterator start, Iterator finish, Key key, no_compare)
- { return boost::detail::lower_bound(start, finish, key); }
-
- template <class Iterator, class Key>
- static Iterator upper_bound(Iterator start, Iterator finish, Key key, no_compare)
- { return boost::detail::upper_bound(start, finish, key); }
-
- template <class Iterator, class Key>
- static std::pair<Iterator, Iterator> equal_range(Iterator start, Iterator finish, Key key, no_compare)
- { return boost::detail::equal_range(start, finish, key); }
-
- template <class Iterator, class Key>
- static bool binary_search(Iterator start, Iterator finish, Key key, no_compare)
- { return boost::detail::binary_search(start, finish, key); }
-};
-
-template <class Sequence, class Compare>
-void test_loop(Sequence& x, Compare cmp, unsigned long test_count)
-{
- typedef typename Sequence::const_iterator const_iterator;
-
- for (unsigned long i = 0; i < test_count; ++i)
- {
- random_sorted_sequence(x);
- const const_iterator start = x.begin();
- const const_iterator finish = x.end();
-
- unsigned key = random_number();
- const const_iterator l = searches<Compare>::lower_bound(start, finish, key, cmp);
- const const_iterator u = searches<Compare>::upper_bound(start, finish, key, cmp);
-
- bool found_l = false;
- bool found_u = false;
- std::size_t index = 0;
- std::size_t count = 0;
- unsigned last_value = 0;
- for (const_iterator p = start; p != finish; ++p)
- {
- if (p == l)
- found_l = true;
-
- if (p == u)
- {
- assert(found_l);
- found_u = true;
- }
-
- unsigned value = to_int(*p);
- assert(value >= last_value);
- last_value = value;
-
- if (!found_l)
- {
- ++index;
- assert(to_int(*p) < key);
- }
- else if (!found_u)
- {
- ++count;
- assert(to_int(*p) == key);
- }
- else
- assert(to_int(*p) > key);
- }
- assert(found_l || l == finish);
- assert(found_u || u == finish);
-
- std::pair<const_iterator, const_iterator>
- range = searches<Compare>::equal_range(start, finish, key, cmp);
- assert(range.first == l);
- assert(range.second == u);
-
- bool found = searches<Compare>::binary_search(start, finish, key, cmp);
- assert(found == (u != l));
- std::cout << "found " << count << " copies of " << key << " at index " << index << "\n";
- }
-}
-
-}
-
-int main()
-{
- string_vector x;
- std::cout << "=== testing random-access iterators with <: ===\n";
- test_loop(x, no_compare(), 25);
- std::cout << "=== testing random-access iterators with compare: ===\n";
- test_loop(x, cmp(), 25);
-
- std::list<mystring> y;
- std::cout << "=== testing bidirectional iterators with <: ===\n";
- test_loop(y, no_compare(), 25);
- std::cout << "=== testing bidirectional iterators with compare: ===\n";
- test_loop(y, cmp(), 25);
- std::cerr << "******TEST PASSED******\n";
- return 0;
-}
diff --git a/libs/utility/call_traits_test.cpp b/libs/utility/call_traits_test.cpp
index 72852c4dcd..9e49b68a48 100644
--- a/libs/utility/call_traits_test.cpp
+++ b/libs/utility/call_traits_test.cpp
@@ -210,8 +210,10 @@ int main()
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)
@@ -292,7 +294,11 @@ int main()
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;
}
diff --git a/libs/utility/checked_delete.html b/libs/utility/checked_delete.html
index 33b5bcbe49..1b93256155 100644
--- a/libs/utility/checked_delete.html
+++ b/libs/utility/checked_delete.html
@@ -1,122 +1,15 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
- <head>
- <title>Boost: checked_delete.hpp documentation</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
- <table border="0" width="100%">
- <tr>
- <td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A>
- </td>
- <td align="center">
- <h1>checked_delete.hpp</h1>
- </td>
- </tr>
- <tr>
- <td colspan="2" height="64">&nbsp;</td>
- </tr>
- </table>
- <p>
- The header <STRONG>&lt;boost/checked_delete.hpp&gt;</STRONG> defines two
- function templates, <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG>,
- and two class templates, <STRONG>checked_deleter</STRONG> and <STRONG>checked_array_deleter</STRONG>.
- </p>
- <P>The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be
- deleted with a <EM>delete-expression</EM>. When the class has a non-trivial
- destructor, or a class-specific operator delete, the behavior is undefined.
- Some compilers issue a warning when an incomplete type is deleted, but
- unfortunately, not all do, and programmers sometimes ignore or disable
- warnings.</P>
- <P>A particularly troublesome case is when a smart pointer's destructor, such as <STRONG>
- boost::scoped_ptr&lt;T&gt;::~scoped_ptr</STRONG>, is instantiated with an
- incomplete type. This can often lead to silent, hard to track failures.</P>
- <P>The supplied function and class templates can be used to prevent these problems,
- as they require a complete type, and cause a compilation error otherwise.</P>
- <h3><a name="Synopsis">Synopsis</a></h3>
- <pre>
-namespace boost
-{
-
-template&lt;class T&gt; void checked_delete(T * p);
-template&lt;class T&gt; void checked_array_delete(T * p);
-template&lt;class T&gt; struct checked_deleter;
-template&lt;class T&gt; struct checked_array_deleter;
-
-}
-</pre>
- <h3>checked_delete</h3>
- <h4><a name="checked_delete">template&lt;class T&gt; void checked_delete(T * p);</a></h4>
- <blockquote>
- <p>
- <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete p</tt>
- must be well-formed.
- </p>
- <p>
- <b>Effects:</b> <tt>delete p;</tt>
- </p>
- </blockquote>
- <h3>checked_array_delete</h3>
- <h4><a name="checked_array_delete">template&lt;class T&gt; void checked_array_delete(T
- * p);</a></h4>
- <blockquote>
- <p>
- <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete [] p</tt>
- must be well-formed.
- </p>
- <p>
- <b>Effects:</b> <tt>delete [] p;</tt>
- </p>
- </blockquote>
- <h3>checked_deleter</h3>
- <pre>
-template&lt;class T&gt; struct checked_deleter
-{
- typedef void result_type;
- typedef T * argument_type;
- void operator()(T * p) const;
-};
-</pre>
- <h4>void checked_deleter&lt;T&gt;::operator()(T * p) const;</h4>
- <blockquote>
- <p>
- <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete p</tt>
- must be well-formed.
- </p>
- <p>
- <b>Effects:</b> <tt>delete p;</tt>
- </p>
- </blockquote>
- <h3>checked_array_deleter</h3>
- <pre>
-template&lt;class T&gt; struct checked_array_deleter
-{
- typedef void result_type;
- typedef T * argument_type;
- void operator()(T * p) const;
-};
-</pre>
- <h4>void checked_array_deleter&lt;T&gt;::operator()(T * p) const;</h4>
- <blockquote>
- <p>
- <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete [] p</tt>
- must be well-formed.
- </p>
- <p>
- <b>Effects:</b> <tt>delete [] p;</tt>
- </p>
- </blockquote>
- <h3><a name="Acknowledgements">Acknowledgements</a></h3>
- <p>
- The function templates <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG>
- were originally part of <STRONG>&lt;boost/utility.hpp&gt;</STRONG>, and the
- documentation acknowledged Beman Dawes, Dave Abrahams, Vladimir Prus, Rainer
- Deyke, John Maddock, and others as contributors.
- </p>
- <p>
- <br>
- <small>Copyright © 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>
- </body>
+<head>
+<meta http-equiv=refresh content="0; URL=../core/doc/html/core/checked_delete.html">
+<title>Automatic redirection</title>
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../core/doc/html/core/checked_delete.html">checked_delete.html</a>.&nbsp;<hr>
+<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 <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
</html>
diff --git a/libs/utility/checked_delete_test.cpp b/libs/utility/checked_delete_test.cpp
deleted file mode 100644
index 41fdc9a57c..0000000000
--- a/libs/utility/checked_delete_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Boost checked_delete test program ---------------------------------------//
-
-// Copyright Beman Dawes 2001. 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)
-
-// See http://www.boost.org/libs/utility for documentation.
-
-// Revision History
-// 21 May 01 Initial version (Beman Dawes)
-
-#include <boost/checked_delete.hpp> // for checked_delete
-
-// This program demonstrates compiler errors when trying to delete an
-// incomplete type.
-
-namespace
-{
- class Incomplete;
-}
-
-int main()
-{
- Incomplete * p = 0;
- boost::checked_delete(p); // should cause compile time error
- boost::checked_array_delete(p); // should cause compile time error
- return 0;
-} // main
diff --git a/libs/utility/compressed_pair.htm b/libs/utility/compressed_pair.htm
index f054d089eb..0b99bf7ac5 100644
--- a/libs/utility/compressed_pair.htm
+++ b/libs/utility/compressed_pair.htm
@@ -1,76 +1,16 @@
-<html>
- <head>
- <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 5.0">
- <boostcompressed_pair.hpp>
- </head>
- <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080">
- <h2><img src="../../boost.png" width="276" height="86">Header &lt;<a href="../../boost/detail/compressed_pair.hpp">boost/compressed_pair.hpp</a>&gt;</h2>
- <p>All of the contents of &lt;boost/compressed_pair.hpp&gt; are defined inside
- namespace boost.</p>
- <p>The class compressed pair is very similar to std::pair, but if either of the
- template arguments are empty classes, then the "empty base-class optimisation"
- is applied to compress the size of the pair.</p>
- <pre>template &lt;class T1, class T2&gt;
-class compressed_pair
-{
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits&lt;first_type&gt;::param_type first_param_type;
- typedef typename call_traits&lt;second_type&gt;::param_type second_param_type;
- typedef typename call_traits&lt;first_type&gt;::reference first_reference;
- typedef typename call_traits&lt;second_type&gt;::reference second_reference;
- typedef typename call_traits&lt;first_type&gt;::const_reference first_const_reference;
- typedef typename call_traits&lt;second_type&gt;::const_reference second_const_reference;
-
- compressed_pair() : base() {}
- compressed_pair(first_param_type x, second_param_type y);
- explicit compressed_pair(first_param_type x);
- explicit compressed_pair(second_param_type y);
-
- compressed_pair&amp; operator=(const compressed_pair&amp;);
- first_reference first();
- first_const_reference first() const;
+<!--
+Copyright 2014 Daniel James.
+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)
+-->
- second_reference second();
- second_const_reference second() const;
-
- void swap(compressed_pair&amp; y);
-};</pre>
- <p>The two members of the pair can be accessed using the member functions first()
- and second(). Note that not all member functions can be instantiated for all
- template parameter types. In particular compressed_pair can be instantiated for
- reference and array types, however in these cases the range of constructors
- that can be used are limited. If types T1 and T2 are the same type, then there
- is only one version of the single-argument constructor, and this constructor
- initialises both values in the pair to the passed value.</p>
- <P>Note that if either member is a POD type, then that member is not
- zero-initialized by the compressed_pair default constructor: it's up to you to
- supply an initial value for these types if you want them to have a default
- value.</P>
- <p>Note that compressed_pair can not be instantiated if either of the template
- arguments is a union type, unless there is compiler support for
- boost::is_union, or if boost::is_union is specialised for the union type.</p>
- <p>Finally, a word of caution for Visual C++ 6 users: if either argument is an
- 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>
- <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>
- <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>© 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> \ No newline at end of file
+<html>
+<head>
+ <meta http-equiv="refresh" content="0; URL=doc/html/compressed_pair.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="doc/html/compressed_pair.html">doc/html/compressed_pair.html</a>
+</body>
+</html>
diff --git a/libs/utility/current_function.html b/libs/utility/current_function.html
deleted file mode 100644
index 373eb22380..0000000000
--- a/libs/utility/current_function.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
- <head>
- <title>Boost: current_function.hpp documentation</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
- <table border="0" width="100%">
- <tr>
- <td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A>
- </td>
- <td align="center">
- <h1>current_function.hpp</h1>
- </td>
- </tr>
- <tr>
- <td colspan="2" height="64">&nbsp;</td>
- </tr>
- </table>
- <p>
- The header <STRONG>&lt;boost/current_function.hpp&gt;</STRONG> defines a single
- macro, <STRONG>BOOST_CURRENT_FUNCTION</STRONG>,<STRONG> </STRONG>similar to the
- C99 predefined identifier <STRONG>__func__</STRONG>.
- </p>
- <P><STRONG>BOOST_CURRENT_FUNCTION</STRONG> expands to a string literal containing
- the (fully qualified, if possible) name of the enclosing function. If there is
- no enclosing function, the behavior is undefined.</P>
- <p>Some compilers do not provide a way to obtain the name of the current enclosing
- function. On such compilers, the string literal has an unspecified value.</p>
- <p>
- <br>
- <small>Copyright © 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>
- </body>
-</html>
diff --git a/libs/utility/current_function_test.cpp b/libs/utility/current_function_test.cpp
deleted file mode 100644
index 13439011f9..0000000000
--- a/libs/utility/current_function_test.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#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
-
-//
-// current_function_test.cpp - a test for boost/current_function.hpp
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-//
-// 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/current_function.hpp>
-#include <boost/config.hpp>
-#include <cstdio>
-
-void message(char const * file, long line, char const * func, char const * msg)
-{
-#if !defined(BOOST_NO_STDC_NAMESPACE)
- using std::printf;
-#endif
-
- printf("%s(%ld): %s in function '%s'\n", file, line, msg, func);
-}
-
-#define MESSAGE(msg) message(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, msg)
-
-int main()
-{
- MESSAGE("assertion failed");
-
- return 0;
-}
diff --git a/libs/utility/doc/Jamfile.v2 b/libs/utility/doc/Jamfile.v2
index b12d71abab..eb9c35d79f 100644
--- a/libs/utility/doc/Jamfile.v2
+++ b/libs/utility/doc/Jamfile.v2
@@ -6,7 +6,7 @@
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
@@ -42,8 +42,46 @@ using quickbook ;
path-constant boost-images : ../../../doc/src/images ;
+xml base_from_member : base_from_member.qbk ;
+boostbook standalone_base_from_member
+ :
+ base_from_member
+ :
+ # File name of HTML output:
+ <xsl:param>root.filename=base_from_member
+ # 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
+ ;
+
+xml compressed_pair : compressed_pair.qbk ;
+boostbook standalone_compressed_pair
+ :
+ compressed_pair
+ :
+ # File name of HTML output:
+ <xsl:param>root.filename=compressed_pair
+ # 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
+ ;
+
xml declval : declval.qbk ;
-boostbook standalone
+boostbook standalone_declval
:
declval
:
@@ -59,10 +97,23 @@ boostbook standalone
<xsl:param>toc.max.depth=1
# How far down we go with TOC's
<xsl:param>generate.section.toc.level=1
-
;
-
-
-
-
+xml string_ref : string_ref.qbk ;
+boostbook standalone_string_ref
+ :
+ string_ref
+ :
+ # File name of HTML output:
+ <xsl:param>root.filename=string_ref
+ # 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
+ ;
diff --git a/libs/utility/doc/base_from_member.qbk b/libs/utility/doc/base_from_member.qbk
new file mode 100644
index 0000000000..9afd949253
--- /dev/null
+++ b/libs/utility/doc/base_from_member.qbk
@@ -0,0 +1,363 @@
+[/
+ Copyright 2001, 2003, 2004, 2012 Daryle Walker.
+
+ Distributed under the Boost Software License, Version 1.0.
+
+ See accompanying file LICENSE_1_0.txt
+ or copy at http://boost.org/LICENSE_1_0.txt
+]
+
+[article Base_From_Member
+ [quickbook 1.5]
+ [authors [Walker, Daryle]]
+ [copyright 2001, 2003, 2004, 2012 Daryle Walker]
+ [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 Rationale]
+
+When developing a class, sometimes a base class needs to be initialized
+with a member of the current class. As a na\u00EFve example:
+
+ #include <streambuf> /* for std::streambuf */
+ #include <ostream> /* for std::ostream */
+
+ class fdoutbuf
+ : public std::streambuf
+ {
+ public:
+ explicit fdoutbuf( int fd );
+ //...
+ };
+
+ class fdostream
+ : public std::ostream
+ {
+ protected:
+ fdoutbuf buf;
+ public:
+ explicit fdostream( int fd )
+ : buf( fd ), std::ostream( &buf ) {}
+ //...
+ };
+
+This is undefined because C++'s initialization order mandates that the base
+class is initialized before the member it uses. [@http://www.moocat.org R.
+Samuel Klatchko] developed a way around this by using the initialization
+order in his favor. Base classes are intialized in order of declaration, so
+moving the desired member to another base class, that is initialized before
+the desired base class, can ensure proper initialization.
+
+A custom base class can be made for this idiom:
+
+ #include <streambuf> /* for std::streambuf */
+ #include <ostream> /* for std::ostream */
+
+ class fdoutbuf
+ : public std::streambuf
+ {
+ public:
+ explicit fdoutbuf( int fd );
+ //...
+ };
+
+ struct fdostream_pbase
+ {
+ fdoutbuf sbuffer;
+
+ explicit fdostream_pbase( int fd )
+ : sbuffer( fd ) {}
+ };
+
+ class fdostream
+ : private fdostream_pbase
+ , public std::ostream
+ {
+ typedef fdostream_pbase pbase_type;
+ typedef std::ostream base_type;
+
+ public:
+ explicit fdostream( int fd )
+ : pbase_type( fd ), base_type( &sbuffer ) {}
+ //...
+ };
+
+Other projects can use similar custom base classes. The technique is basic
+enough to make a template, with a sample template class in this library.
+The main template parameter is the type of the enclosed member. The
+template class has several (explicit) constructor member templates, which
+implicitly type the constructor arguments and pass them to the member. The
+template class uses implicit copy construction and assignment, cancelling
+them if the enclosed member is non-copyable.
+
+Manually coding a base class may be better if the construction and/or
+copying needs are too complex for the supplied template class, or if the
+compiler is not advanced enough to use it.
+
+Since base classes are unnamed, a class cannot have multiple (direct) base
+classes of the same type. The supplied template class has an extra template
+parameter, an integer, that exists solely to provide type differentiation.
+This parameter has a default value so a single use of a particular member
+type does not need to concern itself with the integer.
+
+[endsect]
+
+[section Synopsis]
+
+ #include <type_traits> /* exposition only */
+
+ #ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY
+ #define BOOST_BASE_FROM_MEMBER_MAX_ARITY 10
+ #endif
+
+ template < typename MemberType, int UniqueID = 0 >
+ class boost::base_from_member
+ {
+ protected:
+ MemberType member;
+
+ #if ``['C++11 is in use]``
+ 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 >
+ explicit base_from_member( T1 x1 );
+
+ template< typename T1, typename T2 >
+ base_from_member( T1 x1, T2 x2 );
+
+ //...
+
+ template< typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7, typename T8, typename T9,
+ 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
+ };
+
+ template < typename MemberType, int UniqueID >
+ class base_from_member<MemberType&, UniqueID>
+ {
+ protected:
+ MemberType& member;
+
+ explicit constexpr base_from_member( MemberType& x )
+ noexcept;
+ };
+
+The class template has a first template parameter `MemberType` representing
+the type of the based-member. It has a last template parameter `UniqueID`,
+that is an `int`, to differentiate between multiple base classes that use
+the same based-member type. The last template parameter has a default value
+of zero if it is omitted. The class template has a protected data member
+called `member` that the derived class can use for later base classes (or
+itself).
+
+If the appropriate features of C++11 are present, there will be a single
+constructor template. It implements ['perfect forwarding] to the best
+constructor call of `member` (if any). The constructor template is marked
+both `constexpr` and `explicit`. The former will be ignored if the
+corresponding inner constructor call (of `member`) 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 `noexcept` 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
+`base_from_member`.)
+
+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.
+
+A specialization for member references offers a single constructor taking
+a `MemberType&`, which is the only way to initialize a reference.
+
+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.
+Explicit conversions may be necessary.
+
+The `BOOST_BASE_FROM_MEMBER_MAX_ARITY` macro constant specifies the maximum
+argument length for the constructor templates. The constant 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.) This constant is ignored when C++11 features are present.
+
+[endsect]
+
+[section Usage]
+
+With the starting example, the `fdoutbuf` sub-object needs to be
+encapsulated in a base class that is inheirited before `std::ostream`.
+
+ #include <boost/utility/base_from_member.hpp>
+
+ #include <streambuf> // for std::streambuf
+ #include <ostream> // for std::ostream
+
+ class fdoutbuf
+ : public std::streambuf
+ {
+ public:
+ explicit fdoutbuf( int fd );
+ //...
+ };
+
+ class fdostream
+ : private boost::base_from_member<fdoutbuf>
+ , public std::ostream
+ {
+ // Helper typedef's
+ typedef boost::base_from_member<fdoutbuf> pbase_type;
+ typedef std::ostream base_type;
+
+ public:
+ explicit fdostream( int fd )
+ : pbase_type( fd ), base_type( &member ){}
+ //...
+ };
+
+The base-from-member idiom is an implementation detail, so it should not
+be visible to the clients (or any derived classes) of `fdostream`. Due to
+the initialization order, the `fdoutbuf` sub-object will get initialized
+before the `std::ostream` sub-object does, making the former sub-object
+safe to use in the latter sub-object's construction. Since the `fdoutbuf`
+sub-object of the final type is the only sub-object with the name `member`
+that name can be used unqualified within the final class.
+
+[endsect]
+
+[section Example]
+
+The base-from-member class templates should commonly involve only one
+base-from-member sub-object, usually for attaching a stream-buffer to an
+I/O stream. The next example demonstrates how to use multiple
+base-from-member sub-objects and the resulting qualification issues.
+
+ #include <boost/utility/base_from_member.hpp>
+
+ #include <cstddef> /* for NULL */
+
+ struct an_int
+ {
+ int y;
+
+ an_int( float yf );
+ };
+
+ class switcher
+ {
+ public:
+ switcher();
+ switcher( double, int * );
+ //...
+ };
+
+ class flow_regulator
+ {
+ public:
+ flow_regulator( switcher &, switcher & );
+ //...
+ };
+
+ template < unsigned Size >
+ class fan
+ {
+ public:
+ explicit fan( switcher );
+ //...
+ };
+
+ class system
+ : private boost::base_from_member<an_int>
+ , private boost::base_from_member<switcher>
+ , private boost::base_from_member<switcher, 1>
+ , private boost::base_from_member<switcher, 2>
+ , protected flow_regulator
+ , public fan<6>
+ {
+ // Helper typedef's
+ typedef boost::base_from_member<an_int> pbase0_type;
+ typedef boost::base_from_member<switcher> pbase1_type;
+ typedef boost::base_from_member<switcher, 1> pbase2_type;
+ typedef boost::base_from_member<switcher, 2> pbase3_type;
+
+ typedef flow_regulator base1_type;
+ typedef fan<6> base2_type;
+
+ public:
+ system( double x );
+ //...
+ };
+
+ system::system( double x )
+ : pbase0_type( 0.2 )
+ , pbase1_type()
+ , pbase2_type( -16, &this->pbase0_type::member.y )
+ , pbase3_type( x, static_cast<int *>(NULL) )
+ , base1_type( pbase3_type::member, pbase1_type::member )
+ , base2_type( pbase2_type::member )
+ {
+ //...
+ }
+
+The final class has multiple sub-objects with the name `member`, so any
+use of that name needs qualification by a name of the appropriate base
+type. (Using `typedef`s ease mentioning the base types.) However, the fix
+introduces a new problem when a pointer is needed. Using the address
+operator with a sub-object qualified with its class's name results in a
+pointer-to-member (here, having a type of `an_int boost::base_from_member<
+an_int, 0> :: *`) instead of a pointer to the member (having a type of
+`an_int *`). The new problem is fixed by qualifying the sub-object with
+`this->` and is needed just for pointers, and not for references or values.
+
+There are some argument conversions in the initialization. The constructor
+argument for `pbase0_type` is converted from `double` to `float`. The first
+constructor argument for `pbase2_type` is converted from `int` to `double`.
+The second constructor argument for `pbase3_type` is a special case of
+necessary conversion; all forms of the null-pointer literal in C++ (except
+`nullptr` from C++11) 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
+`switcher`'s constructor. (If C++11's `nullptr` is used, it still needs a
+conversion if multiple pointer types can be accepted in a constructor call
+but `std::nullptr_t` cannot.)
+
+[endsect]
+
+[section Acknowledgments]
+
+* [@http://www.boost.org/people/ed_brey.htm Ed Brey] suggested some interface
+changes.
+
+* [@http://www.moocat.org R. Samuel Klatchko] ([@mailto:rsk@moocat.org
+rsk@moocat.org], [@mailto:rsk@brightmail.com rsk@brightmail.com]) invented
+the idiom of how to use a class member for initializing a base class.
+
+* [@http://www.boost.org/people/dietmar_kuehl.htm Dietmar Kuehl] popularized the
+ base-from-member idiom in his [@http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/
+ IOStream example classes].
+
+* Jonathan Turkanis supplied an implementation of generating the constructor
+templates that can be controlled and automated with macros. The
+implementation uses the [@../../../preprocessor/index.html Preprocessor library].
+
+* [@http://www.boost.org/people/daryle_walker.html">Daryle Walker] started the
+library. Contributed the test file [@../../base_from_member_test.cpp
+base_from_member_test.cpp].
+
+[endsect]
+
diff --git a/libs/utility/doc/compressed_pair.qbk b/libs/utility/doc/compressed_pair.qbk
new file mode 100644
index 0000000000..eac4266b4e
--- /dev/null
+++ b/libs/utility/doc/compressed_pair.qbk
@@ -0,0 +1,99 @@
+[/
+ Copyright 2000 Beman Dawes & John Maddock.
+
+ Distributed under the Boost Software License, Version 1.0.
+
+ See accompanying file LICENSE_1_0.txt
+ or copy at http://boost.org/LICENSE_1_0.txt
+]
+
+[article Compressed_Pair
+ [quickbook 1.5]
+ [authors [Cleary, Steve]]
+ [authors [Dawes, Beman]]
+ [authors [Hinnant, Howard]]
+ [authors [Maddock, John]]
+ [copyright 2000 Steve Cleary, Beman Dawes, Howard Hinnant &amp; John Maddock]
+ [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]
+
+All of the contents of `<boost/compressed_pair.hpp>` are defined inside
+`namespace boost`.
+
+The class `compressed_pair` is very similar to `std::pair`, but if either of
+the template arguments are empty classes, then the ['empty base-class
+optimisation] is applied to compress the size of the pair.
+
+[endsect]
+
+[section Synopsis]
+
+ template <class T1, class T2>
+ class compressed_pair
+ {
+ public:
+ typedef T1 first_type;
+ typedef T2 second_type;
+ typedef typename call_traits<first_type>::param_type first_param_type;
+ typedef typename call_traits<second_type>::param_type second_param_type;
+ typedef typename call_traits<first_type>::reference first_reference;
+ typedef typename call_traits<second_type>::reference second_reference;
+ typedef typename call_traits<first_type>::const_reference first_const_reference;
+ typedef typename call_traits<second_type>::const_reference second_const_reference;
+
+ compressed_pair() : base() {}
+ compressed_pair(first_param_type x, second_param_type y);
+ explicit compressed_pair(first_param_type x);
+ explicit compressed_pair(second_param_type y);
+
+ compressed_pair& operator=(const compressed_pair&);
+
+ first_reference first();
+ first_const_reference first() const;
+
+ second_reference second();
+ second_const_reference second() const;
+
+ void swap(compressed_pair& y);
+ };
+
+The two members of the pair can be accessed using the member functions
+`first()` and `second()`. Note that not all member functions can be
+instantiated for all template parameter types. In particular
+`compressed_pair` can be instantiated for reference and array types,
+however in these cases the range of constructors that can be used are
+limited. If types `T1` and `T2` are the same type, then there is only
+one version of the single-argument constructor, and this constructor
+initialises both values in the pair to the passed value.
+
+Note that if either member is a POD type, then that member is not
+zero-initialized by the `compressed_pair` default constructor: it's up
+to you to supply an initial value for these types if you want them to have
+a default value.
+
+Note that `compressed_pair` can not be instantiated if either of the
+template arguments is a union type, unless there is compiler support for
+`boost::is_union`, or if `boost::is_union` is specialised for the union
+type.
+
+Finally, a word of caution for Visual C++ 6 users: if either argument is an
+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.
+
+[endsect]
+
+[section Acknowledgments]
+
+Based on contributions by Steve Cleary, Beman Dawes, Howard Hinnant and
+John Maddock.
+
+Maintained by [@mailto:john@johnmaddock.co.uk John Maddock].
+
+[endsect]
diff --git a/libs/utility/doc/declval.qbk b/libs/utility/doc/declval.qbk
index 7bf5cb5ca9..910aaf6a60 100644
--- a/libs/utility/doc/declval.qbk
+++ b/libs/utility/doc/declval.qbk
@@ -106,7 +106,6 @@ Declares a function template convert which only participates in overloading if t
Fixes:
* [@http://svn.boost.org/trac/boost/ticket/6570 #6570] Adding noexcept to boost::declval.
-
[endsect]
diff --git a/libs/utility/doc/html/base_from_member.html b/libs/utility/doc/html/base_from_member.html
new file mode 100644
index 0000000000..664bfabdf3
--- /dev/null
+++ b/libs/utility/doc/html/base_from_member.html
@@ -0,0 +1,437 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Base_From_Member</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="base_from_member.html" title="Base_From_Member">
+</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="base_from_member"></a>Base_From_Member</h2></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Daryle</span> <span class="surname">Walker</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright &#169; 2001, 2003, 2004, 2012 Daryle
+ Walker</p></div>
+<div><div class="legalnotice">
+<a name="base_from_member.legal"></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 class="toc">
+<dt><span class="section"><a href="base_from_member.html#base_from_member.rationale">Rationale</a></span></dt>
+<dt><span class="section"><a href="base_from_member.html#base_from_member.synopsis">Synopsis</a></span></dt>
+<dt><span class="section"><a href="base_from_member.html#base_from_member.usage">Usage</a></span></dt>
+<dt><span class="section"><a href="base_from_member.html#base_from_member.example">Example</a></span></dt>
+<dt><span class="section"><a href="base_from_member.html#base_from_member.acknowledgments">Acknowledgments</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="base_from_member.rationale"></a><a class="link" href="base_from_member.html#base_from_member.rationale" title="Rationale">Rationale</a>
+</h2></div></div></div>
+<p>
+ When developing a class, sometimes a base class needs to be initialized with
+ a member of the current class. As a na&#239;ve example:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">streambuf</span><span class="special">&gt;</span> <span class="comment">/* for std::streambuf */</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">ostream</span><span class="special">&gt;</span> <span class="comment">/* for std::ostream */</span>
+
+<span class="keyword">class</span> <span class="identifier">fdoutbuf</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">streambuf</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdoutbuf</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">fdostream</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span>
+<span class="special">{</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="identifier">fdoutbuf</span> <span class="identifier">buf</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdostream</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">buf</span><span class="special">(</span> <span class="identifier">fd</span> <span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">(</span> <span class="special">&amp;</span><span class="identifier">buf</span> <span class="special">)</span> <span class="special">{}</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ This is undefined because C++'s initialization order mandates that the base
+ class is initialized before the member it uses. <a href="http://www.moocat.org" target="_top">R.
+ Samuel Klatchko</a> developed a way around this by using the initialization
+ order in his favor. Base classes are intialized in order of declaration, so
+ moving the desired member to another base class, that is initialized before
+ the desired base class, can ensure proper initialization.
+ </p>
+<p>
+ A custom base class can be made for this idiom:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">streambuf</span><span class="special">&gt;</span> <span class="comment">/* for std::streambuf */</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">ostream</span><span class="special">&gt;</span> <span class="comment">/* for std::ostream */</span>
+
+<span class="keyword">class</span> <span class="identifier">fdoutbuf</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">streambuf</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdoutbuf</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">struct</span> <span class="identifier">fdostream_pbase</span>
+<span class="special">{</span>
+ <span class="identifier">fdoutbuf</span> <span class="identifier">sbuffer</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">fdostream_pbase</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">sbuffer</span><span class="special">(</span> <span class="identifier">fd</span> <span class="special">)</span> <span class="special">{}</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">fdostream</span>
+ <span class="special">:</span> <span class="keyword">private</span> <span class="identifier">fdostream_pbase</span>
+ <span class="special">,</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">fdostream_pbase</span> <span class="identifier">pbase_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="identifier">base_type</span><span class="special">;</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdostream</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">pbase_type</span><span class="special">(</span> <span class="identifier">fd</span> <span class="special">),</span> <span class="identifier">base_type</span><span class="special">(</span> <span class="special">&amp;</span><span class="identifier">sbuffer</span> <span class="special">)</span> <span class="special">{}</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Other projects can use similar custom base classes. The technique is basic
+ enough to make a template, with a sample template class in this library. The
+ main template parameter is the type of the enclosed member. The template class
+ has several (explicit) constructor member templates, which implicitly type
+ the constructor arguments and pass them to the member. The template class uses
+ implicit copy construction and assignment, cancelling them if the enclosed
+ member is non-copyable.
+ </p>
+<p>
+ Manually coding a base class may be better if the construction and/or copying
+ needs are too complex for the supplied template class, or if the compiler is
+ not advanced enough to use it.
+ </p>
+<p>
+ Since base classes are unnamed, a class cannot have multiple (direct) base
+ classes of the same type. The supplied template class has an extra template
+ parameter, an integer, that exists solely to provide type differentiation.
+ This parameter has a default value so a single use of a particular member type
+ does not need to concern itself with the integer.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="base_from_member.synopsis"></a><a class="link" href="base_from_member.html#base_from_member.synopsis" title="Synopsis">Synopsis</a>
+</h2></div></div></div>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">type_traits</span><span class="special">&gt;</span> <span class="comment">/* exposition only */</span>
+
+<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_BASE_FROM_MEMBER_MAX_ARITY</span>
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_BASE_FROM_MEMBER_MAX_ARITY</span> <span class="number">10</span>
+<span class="preprocessor">#endif</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">MemberType</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">UniqueID</span> <span class="special">=</span> <span class="number">0</span> <span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span>
+<span class="special">{</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="identifier">MemberType</span> <span class="identifier">member</span><span class="special">;</span>
+
+<span class="preprocessor">#if</span> <span class="emphasis"><em>C++11 is in use</em></span>
+ <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="special">...</span><span class="identifier">T</span> <span class="special">&gt;</span>
+ <span class="keyword">explicit</span> <span class="keyword">constexpr</span> <span class="identifier">base_from_member</span><span class="special">(</span> <span class="identifier">T</span><span class="special">&amp;&amp;</span> <span class="special">...</span><span class="identifier">x</span> <span class="special">)</span>
+ <span class="keyword">noexcept</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">is_nothrow_constructible</span><span class="special">&lt;</span><span class="identifier">MemberType</span><span class="special">,</span> <span class="identifier">T</span><span class="special">...&gt;::</span><span class="identifier">value</span> <span class="special">);</span>
+<span class="preprocessor">#else</span>
+ <span class="identifier">base_from_member</span><span class="special">();</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T1</span> <span class="special">&gt;</span>
+ <span class="keyword">explicit</span> <span class="identifier">base_from_member</span><span class="special">(</span> <span class="identifier">T1</span> <span class="identifier">x1</span> <span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span> <span class="special">&gt;</span>
+ <span class="identifier">base_from_member</span><span class="special">(</span> <span class="identifier">T1</span> <span class="identifier">x1</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x2</span> <span class="special">);</span>
+
+ <span class="comment">//...</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T4</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">T5</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T6</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T7</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T8</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T9</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">T10</span> <span class="special">&gt;</span>
+ <span class="identifier">base_from_member</span><span class="special">(</span> <span class="identifier">T1</span> <span class="identifier">x1</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x2</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x3</span><span class="special">,</span> <span class="identifier">T4</span> <span class="identifier">x4</span><span class="special">,</span> <span class="identifier">T5</span> <span class="identifier">x5</span><span class="special">,</span> <span class="identifier">T6</span> <span class="identifier">x6</span><span class="special">,</span> <span class="identifier">T7</span> <span class="identifier">x7</span><span class="special">,</span>
+ <span class="identifier">T8</span> <span class="identifier">x8</span><span class="special">,</span> <span class="identifier">T9</span> <span class="identifier">x9</span><span class="special">,</span> <span class="identifier">T10</span> <span class="identifier">x10</span> <span class="special">);</span>
+<span class="preprocessor">#endif</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">MemberType</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">UniqueID</span> <span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">MemberType</span><span class="special">&amp;,</span> <span class="identifier">UniqueID</span><span class="special">&gt;</span>
+<span class="special">{</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="identifier">MemberType</span><span class="special">&amp;</span> <span class="identifier">member</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="keyword">constexpr</span> <span class="identifier">base_from_member</span><span class="special">(</span> <span class="identifier">MemberType</span><span class="special">&amp;</span> <span class="identifier">x</span> <span class="special">)</span>
+ <span class="keyword">noexcept</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The class template has a first template parameter <code class="computeroutput"><span class="identifier">MemberType</span></code>
+ representing the type of the based-member. It has a last template parameter
+ <code class="computeroutput"><span class="identifier">UniqueID</span></code>, that is an <code class="computeroutput"><span class="keyword">int</span></code>, to differentiate between multiple base
+ classes that use the same based-member type. The last template parameter has
+ a default value of zero if it is omitted. The class template has a protected
+ data member called <code class="computeroutput"><span class="identifier">member</span></code> that
+ the derived class can use for later base classes (or itself).
+ </p>
+<p>
+ If the appropriate features of C++11 are present, there will be a single constructor
+ template. It implements <span class="emphasis"><em>perfect forwarding</em></span> to the best
+ constructor call of <code class="computeroutput"><span class="identifier">member</span></code>
+ (if any). The constructor template is marked both <code class="computeroutput"><span class="keyword">constexpr</span></code>
+ and <code class="computeroutput"><span class="keyword">explicit</span></code>. The former will
+ be ignored if the corresponding inner constructor call (of <code class="computeroutput"><span class="identifier">member</span></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 class="computeroutput"><span class="keyword">noexcept</span></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 class="computeroutput"><span class="identifier">base_from_member</span></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>
+ A specialization for member references offers a single constructor taking a
+ <code class="computeroutput"><span class="identifier">MemberType</span><span class="special">&amp;</span></code>,
+ which is the only way to initialize a reference.
+ </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.
+ Explicit conversions may be necessary.
+ </p>
+<p>
+ The <code class="computeroutput"><span class="identifier">BOOST_BASE_FROM_MEMBER_MAX_ARITY</span></code>
+ macro constant specifies the maximum argument length for the constructor templates.
+ The constant 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.) This constant is ignored when C++11 features are present.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="base_from_member.usage"></a><a class="link" href="base_from_member.html#base_from_member.usage" title="Usage">Usage</a>
+</h2></div></div></div>
+<p>
+ With the starting example, the <code class="computeroutput"><span class="identifier">fdoutbuf</span></code>
+ sub-object needs to be encapsulated in a base class that is inheirited before
+ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span></code>.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">base_from_member</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">streambuf</span><span class="special">&gt;</span> <span class="comment">// for std::streambuf</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">ostream</span><span class="special">&gt;</span> <span class="comment">// for std::ostream</span>
+
+<span class="keyword">class</span> <span class="identifier">fdoutbuf</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">streambuf</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdoutbuf</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">fdostream</span>
+ <span class="special">:</span> <span class="keyword">private</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">fdoutbuf</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span>
+<span class="special">{</span>
+ <span class="comment">// Helper typedef's</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">fdoutbuf</span><span class="special">&gt;</span> <span class="identifier">pbase_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="identifier">base_type</span><span class="special">;</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fdostream</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">fd</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">pbase_type</span><span class="special">(</span> <span class="identifier">fd</span> <span class="special">),</span> <span class="identifier">base_type</span><span class="special">(</span> <span class="special">&amp;</span><span class="identifier">member</span> <span class="special">){}</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The base-from-member idiom is an implementation detail, so it should not be
+ visible to the clients (or any derived classes) of <code class="computeroutput"><span class="identifier">fdostream</span></code>.
+ Due to the initialization order, the <code class="computeroutput"><span class="identifier">fdoutbuf</span></code>
+ sub-object will get initialized before the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span></code>
+ sub-object does, making the former sub-object safe to use in the latter sub-object's
+ construction. Since the <code class="computeroutput"><span class="identifier">fdoutbuf</span></code>
+ sub-object of the final type is the only sub-object with the name <code class="computeroutput"><span class="identifier">member</span></code> that name can be used unqualified
+ within the final class.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="base_from_member.example"></a><a class="link" href="base_from_member.html#base_from_member.example" title="Example">Example</a>
+</h2></div></div></div>
+<p>
+ The base-from-member class templates should commonly involve only one base-from-member
+ sub-object, usually for attaching a stream-buffer to an I/O stream. The next
+ example demonstrates how to use multiple base-from-member sub-objects and the
+ resulting qualification issues.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">base_from_member</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cstddef</span><span class="special">&gt;</span> <span class="comment">/* for NULL */</span>
+
+<span class="keyword">struct</span> <span class="identifier">an_int</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">y</span><span class="special">;</span>
+
+ <span class="identifier">an_int</span><span class="special">(</span> <span class="keyword">float</span> <span class="identifier">yf</span> <span class="special">);</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">switcher</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">switcher</span><span class="special">();</span>
+ <span class="identifier">switcher</span><span class="special">(</span> <span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">*</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">flow_regulator</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">flow_regulator</span><span class="special">(</span> <span class="identifier">switcher</span> <span class="special">&amp;,</span> <span class="identifier">switcher</span> <span class="special">&amp;</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span> <span class="keyword">unsigned</span> <span class="identifier">Size</span> <span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">fan</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">fan</span><span class="special">(</span> <span class="identifier">switcher</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">system</span>
+ <span class="special">:</span> <span class="keyword">private</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">an_int</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="keyword">private</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="keyword">private</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="keyword">private</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="keyword">protected</span> <span class="identifier">flow_regulator</span>
+ <span class="special">,</span> <span class="keyword">public</span> <span class="identifier">fan</span><span class="special">&lt;</span><span class="number">6</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="comment">// Helper typedef's</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">an_int</span><span class="special">&gt;</span> <span class="identifier">pbase0_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">&gt;</span> <span class="identifier">pbase1_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;</span> <span class="identifier">pbase2_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span><span class="identifier">switcher</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;</span> <span class="identifier">pbase3_type</span><span class="special">;</span>
+
+ <span class="keyword">typedef</span> <span class="identifier">flow_regulator</span> <span class="identifier">base1_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">fan</span><span class="special">&lt;</span><span class="number">6</span><span class="special">&gt;</span> <span class="identifier">base2_type</span><span class="special">;</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">system</span><span class="special">(</span> <span class="keyword">double</span> <span class="identifier">x</span> <span class="special">);</span>
+ <span class="comment">//...</span>
+<span class="special">};</span>
+
+<span class="identifier">system</span><span class="special">::</span><span class="identifier">system</span><span class="special">(</span> <span class="keyword">double</span> <span class="identifier">x</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">pbase0_type</span><span class="special">(</span> <span class="number">0.2</span> <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">pbase1_type</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">pbase2_type</span><span class="special">(</span> <span class="special">-</span><span class="number">16</span><span class="special">,</span> <span class="special">&amp;</span><span class="keyword">this</span><span class="special">-&gt;</span><span class="identifier">pbase0_type</span><span class="special">::</span><span class="identifier">member</span><span class="special">.</span><span class="identifier">y</span> <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">pbase3_type</span><span class="special">(</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">int</span> <span class="special">*&gt;(</span><span class="identifier">NULL</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">base1_type</span><span class="special">(</span> <span class="identifier">pbase3_type</span><span class="special">::</span><span class="identifier">member</span><span class="special">,</span> <span class="identifier">pbase1_type</span><span class="special">::</span><span class="identifier">member</span> <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">base2_type</span><span class="special">(</span> <span class="identifier">pbase2_type</span><span class="special">::</span><span class="identifier">member</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="comment">//...</span>
+<span class="special">}</span>
+</pre>
+<p>
+ The final class has multiple sub-objects with the name <code class="computeroutput"><span class="identifier">member</span></code>,
+ so any use of that name needs qualification by a name of the appropriate base
+ type. (Using <code class="computeroutput"><span class="keyword">typedef</span></code>s ease mentioning
+ the base types.) However, the fix introduces a new problem when a pointer is
+ needed. Using the address operator with a sub-object qualified with its class's
+ name results in a pointer-to-member (here, having a type of <code class="computeroutput"><span class="identifier">an_int</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">base_from_member</span><span class="special">&lt;</span>
+ <span class="identifier">an_int</span><span class="special">,</span>
+ <span class="number">0</span><span class="special">&gt;</span> <span class="special">::</span> <span class="special">*</span></code>) instead
+ of a pointer to the member (having a type of <code class="computeroutput"><span class="identifier">an_int</span>
+ <span class="special">*</span></code>). The new problem is fixed by qualifying
+ the sub-object with <code class="computeroutput"><span class="keyword">this</span><span class="special">-&gt;</span></code>
+ and is needed just for pointers, and not for references or values.
+ </p>
+<p>
+ There are some argument conversions in the initialization. The constructor
+ argument for <code class="computeroutput"><span class="identifier">pbase0_type</span></code> is
+ converted from <code class="computeroutput"><span class="keyword">double</span></code> to <code class="computeroutput"><span class="keyword">float</span></code>. The first constructor argument for <code class="computeroutput"><span class="identifier">pbase2_type</span></code> is converted from <code class="computeroutput"><span class="keyword">int</span></code> to <code class="computeroutput"><span class="keyword">double</span></code>.
+ The second constructor argument for <code class="computeroutput"><span class="identifier">pbase3_type</span></code>
+ is a special case of necessary conversion; all forms of the null-pointer literal
+ in C++ (except <code class="computeroutput"><span class="keyword">nullptr</span></code> from C++11)
+ 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 class="computeroutput"><span class="identifier">switcher</span></code>'s
+ constructor. (If C++11's <code class="computeroutput"><span class="keyword">nullptr</span></code>
+ is used, it still needs a conversion if multiple pointer types can be accepted
+ in a constructor call but <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">nullptr_t</span></code>
+ cannot.)
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="base_from_member.acknowledgments"></a><a class="link" href="base_from_member.html#base_from_member.acknowledgments" title="Acknowledgments">Acknowledgments</a>
+</h2></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <a href="http://www.boost.org/people/ed_brey.htm" target="_top">Ed Brey</a> suggested
+ some interface changes.
+ </li>
+<li class="listitem">
+ <a href="http://www.moocat.org" target="_top">R. Samuel Klatchko</a> (<a href="mailto:rsk%40moocat.org" target="_top">rsk@moocat.org</a>,
+ <a href="mailto:rsk%40brightmail.com" target="_top">rsk@brightmail.com</a>) invented
+ the idiom of how to use a class member for initializing a base class.
+ </li>
+<li class="listitem">
+ <a href="http://www.boost.org/people/dietmar_kuehl.htm" target="_top">Dietmar Kuehl</a>
+ popularized the base-from-member idiom in his <a href="http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/" target="_top">IOStream
+ example classes</a>.
+ </li>
+<li class="listitem">
+ Jonathan Turkanis supplied an implementation of generating the constructor
+ templates that can be controlled and automated with macros. The implementation
+ uses the <a href="../../../preprocessor/index.html" target="_top">Preprocessor library</a>.
+ </li>
+<li class="listitem">
+ <a href="http://www.boost.org/people/daryle_walker.html%22%3eDaryle" target="_top">Walker</a>
+ started the library. Contributed the test file <a href="../../base_from_member_test.cpp" target="_top">base_from_member_test.cpp</a>.
+ </li>
+</ul></div>
+</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: October 30, 2014 at 10:17:13 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
diff --git a/libs/utility/doc/html/compressed_pair.html b/libs/utility/doc/html/compressed_pair.html
new file mode 100644
index 0000000000..c879d4c9d2
--- /dev/null
+++ b/libs/utility/doc/html/compressed_pair.html
@@ -0,0 +1,155 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Compressed_Pair</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="compressed_pair.html" title="Compressed_Pair">
+</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="compressed_pair"></a>Compressed_Pair</h2></div>
+<div><div class="authorgroup">
+<div class="author"><h3 class="author">
+<span class="firstname">Steve</span> <span class="surname">Cleary</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">Howard</span> <span class="surname">Hinnant</span>
+</h3></div>
+<div class="author"><h3 class="author">
+<span class="firstname">John</span> <span class="surname">Maddock</span>
+</h3></div>
+</div></div>
+<div><p class="copyright">Copyright &#169; 2000 Steve Cleary, Beman Dawes, Howard Hinnant &amp; John
+ Maddock</p></div>
+<div><div class="legalnotice">
+<a name="compressed_pair.legal"></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 class="toc">
+<dt><span class="section"><a href="compressed_pair.html#compressed_pair.overview">Overview</a></span></dt>
+<dt><span class="section"><a href="compressed_pair.html#compressed_pair.synopsis">Synopsis</a></span></dt>
+<dt><span class="section"><a href="compressed_pair.html#compressed_pair.acknowledgments">Acknowledgments</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="compressed_pair.overview"></a><a class="link" href="compressed_pair.html#compressed_pair.overview" title="Overview">Overview</a>
+</h2></div></div></div>
+<p>
+ All of the contents of <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">compressed_pair</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ are defined inside <code class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">boost</span></code>.
+ </p>
+<p>
+ The class <code class="computeroutput"><span class="identifier">compressed_pair</span></code> is
+ very similar to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>, but if either of the template arguments
+ are empty classes, then the <span class="emphasis"><em>empty base-class optimisation</em></span>
+ is applied to compress the size of the pair.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="compressed_pair.synopsis"></a><a class="link" href="compressed_pair.html#compressed_pair.synopsis" title="Synopsis">Synopsis</a>
+</h2></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">compressed_pair</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">T1</span> <span class="identifier">first_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">T2</span> <span class="identifier">second_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">first_type</span><span class="special">&gt;::</span><span class="identifier">param_type</span> <span class="identifier">first_param_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">second_type</span><span class="special">&gt;::</span><span class="identifier">param_type</span> <span class="identifier">second_param_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">first_type</span><span class="special">&gt;::</span><span class="identifier">reference</span> <span class="identifier">first_reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">second_type</span><span class="special">&gt;::</span><span class="identifier">reference</span> <span class="identifier">second_reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">first_type</span><span class="special">&gt;::</span><span class="identifier">const_reference</span> <span class="identifier">first_const_reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">call_traits</span><span class="special">&lt;</span><span class="identifier">second_type</span><span class="special">&gt;::</span><span class="identifier">const_reference</span> <span class="identifier">second_const_reference</span><span class="special">;</span>
+
+ <span class="identifier">compressed_pair</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">base</span><span class="special">()</span> <span class="special">{}</span>
+ <span class="identifier">compressed_pair</span><span class="special">(</span><span class="identifier">first_param_type</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">second_param_type</span> <span class="identifier">y</span><span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">compressed_pair</span><span class="special">(</span><span class="identifier">first_param_type</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">compressed_pair</span><span class="special">(</span><span class="identifier">second_param_type</span> <span class="identifier">y</span><span class="special">);</span>
+
+ <span class="identifier">compressed_pair</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">compressed_pair</span><span class="special">&amp;);</span>
+
+ <span class="identifier">first_reference</span> <span class="identifier">first</span><span class="special">();</span>
+ <span class="identifier">first_const_reference</span> <span class="identifier">first</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="identifier">second_reference</span> <span class="identifier">second</span><span class="special">();</span>
+ <span class="identifier">second_const_reference</span> <span class="identifier">second</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">compressed_pair</span><span class="special">&amp;</span> <span class="identifier">y</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The two members of the pair can be accessed using the member functions <code class="computeroutput"><span class="identifier">first</span><span class="special">()</span></code> and
+ <code class="computeroutput"><span class="identifier">second</span><span class="special">()</span></code>.
+ Note that not all member functions can be instantiated for all template parameter
+ types. In particular <code class="computeroutput"><span class="identifier">compressed_pair</span></code>
+ can be instantiated for reference and array types, however in these cases the
+ range of constructors that can be used are limited. If types <code class="computeroutput"><span class="identifier">T1</span></code> and <code class="computeroutput"><span class="identifier">T2</span></code>
+ are the same type, then there is only one version of the single-argument constructor,
+ and this constructor initialises both values in the pair to the passed value.
+ </p>
+<p>
+ Note that if either member is a POD type, then that member is not zero-initialized
+ by the <code class="computeroutput"><span class="identifier">compressed_pair</span></code> default
+ constructor: it's up to you to supply an initial value for these types if you
+ want them to have a default value.
+ </p>
+<p>
+ Note that <code class="computeroutput"><span class="identifier">compressed_pair</span></code> can
+ not be instantiated if either of the template arguments is a union type, unless
+ there is compiler support for <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_union</span></code>,
+ or if <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_union</span></code> is specialised for the union type.
+ </p>
+<p>
+ Finally, a word of caution for Visual C++ 6 users: if either argument is an
+ 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>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="compressed_pair.acknowledgments"></a><a class="link" href="compressed_pair.html#compressed_pair.acknowledgments" title="Acknowledgments">Acknowledgments</a>
+</h2></div></div></div>
+<p>
+ Based on contributions by Steve Cleary, Beman Dawes, Howard Hinnant and John
+ Maddock.
+ </p>
+<p>
+ Maintained by <a href="mailto:john%40johnmaddock.co.uk" target="_top">John Maddock</a>.
+ </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: October 30, 2014 at 10:17:14 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
diff --git a/libs/utility/doc/html/declval.html b/libs/utility/doc/html/declval.html
index 43dd657ffb..d2ebf6580f 100644
--- a/libs/utility/doc/html/declval.html
+++ b/libs/utility/doc/html/declval.html
@@ -3,7 +3,7 @@
<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.76.0">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="declval.html" title="Declval">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -31,9 +31,10 @@
</h3></div>
</div></div>
<div><p class="copyright">Copyright &#169; 2008 Howard Hinnant</p></div>
-<div><p class="copyright">Copyright &#169; 2009 -2012 Vicente J. Botet Escriba</p></div>
+<div><p class="copyright">Copyright &#169; 2009-2012 Vicente
+ J. Botet Escriba</p></div>
<div><div class="legalnotice">
-<a name="idp13449552"></a><p>
+<a name="declval.legal"></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>
@@ -43,7 +44,7 @@
</div>
<div class="toc">
<p><b>Table of Contents</b></p>
-<dl>
+<dl class="toc">
<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>
<dt><span class="section"><a href="declval.html#declval.history">History</a></span></dt>
@@ -66,13 +67,13 @@
in a non-using context, e.g. given the declaration
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
-<span class="identifier">T</span><span class="special">&amp;&amp;</span> <span class="identifier">declval</span><span class="special">();</span> <span class="comment">// not used
-</span></pre>
+<span class="identifier">T</span><span class="special">&amp;&amp;</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">&lt;</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">&gt;</span>
-<span class="identifier">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">To</span><span class="special">&gt;(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">From</span><span class="special">&gt;()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&amp;&amp;);</span>
+<span class="keyword">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">To</span><span class="special">&gt;(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">From</span><span class="special">&gt;()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&amp;&amp;);</span>
</pre>
<p>
or as part of a class template definition
@@ -80,9 +81,9 @@
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">result_of</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</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">&gt;</span>
-<span class="keyword">struct</span> <span class="identifier">result_of</span><span class="special">&lt;</span><span class="identifier">Fn</span><span class="special">(</span><span class="identifier">ArgTypes</span><span class="special">...)&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">result_of</span><span class="special">&lt;</span><span class="identifier">Fn</span><span class="special">(</span><span class="identifier">ArgTypes</span><span class="special">...)&gt;</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">&lt;</span><span class="identifier">Fn</span><span class="special">&gt;()(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">ArgTypes</span><span class="special">&gt;()...))</span> <span class="identifier">type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">decltype</span><span class="special">(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">Fn</span><span class="special">&gt;()(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">ArgTypes</span><span class="special">&gt;()...))</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<p>
@@ -94,8 +95,8 @@
to
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</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">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">();</span> <span class="comment">// not used
-</span></pre>
+<span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</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
@@ -119,10 +120,10 @@
<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">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
- <span class="keyword">typename</span> <span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">()</span> <span class="identifier">noexcept</span><span class="special">;</span> <span class="comment">// as unevaluated operand
-</span>
-<span class="special">}</span> <span class="comment">// namespace boost
-</span></pre>
+ <span class="keyword">typename</span> <span class="identifier">add_rvalue_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">declval</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="comment">// 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.
@@ -142,7 +143,7 @@
<span class="bold"><strong>Example:</strong></span>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</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">&gt;</span>
-<span class="identifier">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">To</span><span class="special">&gt;(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">From</span><span class="special">&gt;()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&amp;&amp;);</span>
+<span class="keyword">decltype</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">To</span><span class="special">&gt;(</span><span class="identifier">declval</span><span class="special">&lt;</span><span class="identifier">From</span><span class="special">&gt;()))</span> <span class="identifier">convert</span><span class="special">(</span><span class="identifier">From</span><span class="special">&amp;&amp;);</span>
</pre>
<p>
Declares a function template convert which only participates in overloading
@@ -153,21 +154,22 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="declval.history"></a><a class="link" href="declval.html#declval.history" title="History">History</a>
</h2></div></div></div>
-<a name="declval.history.boost_1_50"></a><h4>
-<a name="idp13553216"></a>
- <a class="link" href="declval.html#declval.history.boost_1_50">boost 1.50</a>
+<h4>
+<a name="declval.history.h0"></a>
+ <span class="phrase"><a name="declval.history.boost_1_50"></a></span><a class="link" href="declval.html#declval.history.boost_1_50">boost
+ 1.50</a>
</h4>
<p>
Fixes:
</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<a href="http://svn.boost.org/trac/boost/ticket/6570" target="_top">#6570</a>
Adding noexcept to boost::declval.
</li></ul></div>
</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: May 28, 2012 at 18:59:06 GMT</small></p></td>
+<td align="left"><p><small>Last revised: October 30, 2014 at 10:17:15 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
diff --git a/libs/utility/doc/html/standalone_base_from_member_HTML.manifest b/libs/utility/doc/html/standalone_base_from_member_HTML.manifest
new file mode 100644
index 0000000000..dec55fa6e2
--- /dev/null
+++ b/libs/utility/doc/html/standalone_base_from_member_HTML.manifest
@@ -0,0 +1 @@
+base_from_member.html
diff --git a/libs/utility/doc/html/standalone_compressed_pair_HTML.manifest b/libs/utility/doc/html/standalone_compressed_pair_HTML.manifest
new file mode 100644
index 0000000000..213fbdbd39
--- /dev/null
+++ b/libs/utility/doc/html/standalone_compressed_pair_HTML.manifest
@@ -0,0 +1 @@
+compressed_pair.html
diff --git a/libs/utility/doc/html/standalone_declval_HTML.manifest b/libs/utility/doc/html/standalone_declval_HTML.manifest
new file mode 100644
index 0000000000..f76a68592e
--- /dev/null
+++ b/libs/utility/doc/html/standalone_declval_HTML.manifest
@@ -0,0 +1 @@
+declval.html
diff --git a/libs/utility/doc/html/standalone_string_ref_HTML.manifest b/libs/utility/doc/html/standalone_string_ref_HTML.manifest
new file mode 100644
index 0000000000..2c3d54be43
--- /dev/null
+++ b/libs/utility/doc/html/standalone_string_ref_HTML.manifest
@@ -0,0 +1 @@
+string_ref.html
diff --git a/libs/utility/doc/html/string_ref.html b/libs/utility/doc/html/string_ref.html
new file mode 100644
index 0000000000..88d94e02b8
--- /dev/null
+++ b/libs/utility/doc/html/string_ref.html
@@ -0,0 +1,280 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>String_Ref</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="string_ref.html" title="String_Ref">
+</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="string_ref"></a>String_Ref</h2></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Marshall</span> <span class="surname">Clow</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright &#169; 2012 Marshall Clow</p></div>
+<div><div class="legalnotice">
+<a name="string_ref.legal"></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 class="toc">
+<dt><span class="section"><a href="string_ref.html#string_ref.overview">Overview</a></span></dt>
+<dt><span class="section"><a href="string_ref.html#string_ref.examples">Examples</a></span></dt>
+<dt><span class="section"><a href="string_ref.html#string_ref.reference">Reference </a></span></dt>
+<dt><span class="section"><a href="string_ref.html#string_ref.history">History</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="string_ref.overview"></a><a class="link" href="string_ref.html#string_ref.overview" title="Overview">Overview</a>
+</h2></div></div></div>
+<p>
+ Boost.StringRef is an implementation of Jeffrey Yaskin's <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html" target="_top">N3442:
+ string_ref: a non-owning reference to a string</a>.
+ </p>
+<p>
+ When you are parsing/processing strings from some external source, frequently
+ you want to pass a piece of text to a procedure for specialized processing.
+ The canonical way to do this is as a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>,
+ but that has certain drawbacks:
+ </p>
+<p>
+ 1) If you are processing a buffer of text (say a HTTP response or the contents
+ of a file), then you have to create the string from the text you want to pass,
+ which involves memory allocation and copying of data.
+ </p>
+<p>
+ 2) if a routine receives a constant <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
+ and wants to pass a portion of that string to another routine, then it must
+ create a new string of that substring.
+ </p>
+<p>
+ 3) A routine receives a constant <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
+ and wants to return a portion of the string, then it must create a new string
+ to return.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">string_ref</span></code> is designed to solve
+ these efficiency problems. A <code class="computeroutput"><span class="identifier">string_ref</span></code>
+ is a read-only reference to a contiguous sequence of characters, and provides
+ much of the functionality of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>.
+ A <code class="computeroutput"><span class="identifier">string_ref</span></code> is cheap to create,
+ copy and pass by value, because it does not actually own the storage that it
+ points to.
+ </p>
+<p>
+ A <code class="computeroutput"><span class="identifier">string_ref</span></code> is implemented
+ as a small struct that contains a pointer to the start of the character data
+ and a count. A <code class="computeroutput"><span class="identifier">string_ref</span></code> is
+ cheap to create and cheap to copy.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">string_ref</span></code> acts as a container;
+ it includes all the methods that you would expect in a container, including
+ iteration support, <code class="computeroutput"><span class="keyword">operator</span> <span class="special">[]</span></code>,
+ <code class="computeroutput"><span class="identifier">at</span></code> and <code class="computeroutput"><span class="identifier">size</span></code>.
+ It can be used with any of the iterator-based algorithms in the STL - as long
+ as you don't need to change the underlying data (<code class="computeroutput"><span class="identifier">sort</span></code>
+ and <code class="computeroutput"><span class="identifier">remove</span></code>, for example, will
+ not work)
+ </p>
+<p>
+ Besides generic container functionality, <code class="computeroutput"><span class="identifier">string_ref</span></code>
+ provides a subset of the interface of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>.
+ This makes it easy to replace parameters of type <code class="computeroutput"><span class="keyword">const</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span></code>
+ with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">string_ref</span></code>. Like <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>,
+ <code class="computeroutput"><span class="identifier">string_ref</span></code> has a static member
+ variable named <code class="computeroutput"><span class="identifier">npos</span></code> to denote
+ the result of failed searches, and to mean "the end".
+ </p>
+<p>
+ Because a <code class="computeroutput"><span class="identifier">string_ref</span></code> does not
+ own the data that it "points to", it introduces lifetime issues into
+ code that uses it. The programmer must ensure that the data that a <code class="computeroutput"><span class="identifier">string_ref</span></code> refers to exists as long as the
+ <code class="computeroutput"><span class="identifier">string_ref</span></code> does.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="string_ref.examples"></a><a class="link" href="string_ref.html#string_ref.examples" title="Examples">Examples</a>
+</h2></div></div></div>
+<p>
+ Integrating <code class="computeroutput"><span class="identifier">string_ref</span></code> into
+ your code is fairly simple. Wherever you pass a <code class="computeroutput"><span class="keyword">const</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span></code>
+ or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code> as a parameter, that's a candidate
+ for passing a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">string_ref</span></code>.
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">extract_part</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">bar</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">bar</span><span class="special">.</span><span class="identifier">substr</span> <span class="special">(</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span> <span class="special">);</span>
+ <span class="special">}</span>
+
+<span class="keyword">if</span> <span class="special">(</span> <span class="identifier">extract_part</span> <span class="special">(</span> <span class="string">"ABCDEFG"</span> <span class="special">).</span><span class="identifier">front</span><span class="special">()</span> <span class="special">==</span> <span class="char">'C'</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">/* do something */</span> <span class="special">}</span>
+</pre>
+<p>
+ Let's figure out what happens in this (contrived) example.
+ </p>
+<p>
+ First, a temporary string is created from the string literal <code class="computeroutput"><span class="string">"ABCDEFG"</span></code>, and it is passed (by reference)
+ to the routine <code class="computeroutput"><span class="identifier">extract_part</span></code>.
+ Then a second string is created in the call <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">substr</span></code>
+ and returned to <code class="computeroutput"><span class="identifier">extract_part</span></code>
+ (this copy may be elided by RVO). Then <code class="computeroutput"><span class="identifier">extract_part</span></code>
+ returns that string back to the caller (again this copy may be elided). The
+ first temporary string is deallocated, and <code class="computeroutput"><span class="identifier">front</span></code>
+ is called on the second string, and then it is deallocated as well.
+ </p>
+<p>
+ Two <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>s are created, and two copy operations.
+ That's (potentially) four memory allocations and deallocations, and the associated
+ copying of data.
+ </p>
+<p>
+ Now let's look at the same code with <code class="computeroutput"><span class="identifier">string_ref</span></code>:
+ </p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">string_ref</span> <span class="identifier">extract_part</span> <span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">string_ref</span> <span class="identifier">bar</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">bar</span><span class="special">.</span><span class="identifier">substr</span> <span class="special">(</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span> <span class="special">);</span>
+ <span class="special">}</span>
+
+<span class="keyword">if</span> <span class="special">(</span> <span class="identifier">extract_part</span> <span class="special">(</span> <span class="string">"ABCDEFG"</span> <span class="special">).</span><span class="identifier">front</span><span class="special">()</span> <span class="special">==</span> <span class="string">"C"</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">/* do something */</span> <span class="special">}</span>
+</pre>
+<p>
+ No memory allocations. No copying of character data. No changes to the code
+ other than the types. There are two <code class="computeroutput"><span class="identifier">string_ref</span></code>s
+ created, and two <code class="computeroutput"><span class="identifier">string_ref</span></code>s
+ copied, but those are cheap operations.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="string_ref.reference"></a><a class="link" href="string_ref.html#string_ref.reference" title="Reference">Reference </a>
+</h2></div></div></div>
+<p>
+ The header file "string_ref.hpp" defines a template <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">basic_string_ref</span></code>,
+ and four specializations - for <code class="computeroutput"><span class="keyword">char</span></code>
+ / <code class="computeroutput"><span class="keyword">wchar_t</span></code> / <code class="computeroutput"><span class="keyword">char16_t</span></code>
+ / <code class="computeroutput"><span class="keyword">char32_t</span></code> .
+ </p>
+<p>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">string_ref</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ </p>
+<p>
+ Construction and copying:
+ </p>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">basic_string_ref</span> <span class="special">();</span> <span class="comment">// Constructs an empty string_ref</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">basic_string_ref</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">);</span> <span class="comment">// Constructs from a NULL-terminated string</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">basic_string_ref</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="identifier">len</span><span class="special">);</span> <span class="comment">// Constructs from a pointer, length pair</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
+<span class="identifier">basic_string_ref</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;&amp;</span> <span class="identifier">str</span><span class="special">);</span> <span class="comment">// Constructs from a std::string</span>
+<span class="identifier">basic_string_ref</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string_ref</span> <span class="special">&amp;</span><span class="identifier">rhs</span><span class="special">);</span>
+<span class="identifier">basic_string_ref</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">basic_string_ref</span> <span class="special">&amp;</span><span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">string_ref</span></code> does not define
+ a move constructor nor a move-assignment operator because copying a <code class="computeroutput"><span class="identifier">string_ref</span></code> is just a cheap as moving one.
+ </p>
+<p>
+ Basic container-like functions:
+ </p>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">size_type</span> <span class="identifier">length</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+
+<span class="comment">// All iterators are const_iterators</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">const_iterator</span> <span class="identifier">cbegin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">const_iterator</span> <span class="identifier">cend</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">const_reverse_iterator</span> <span class="identifier">rbegin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">const_reverse_iterator</span> <span class="identifier">crbegin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">const_reverse_iterator</span> <span class="identifier">rend</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">const_reverse_iterator</span> <span class="identifier">crend</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+</pre>
+<p>
+ Access to the individual elements (all of which are const):
+ </p>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span> <span class="identifier">pos</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">&amp;</span> <span class="identifier">at</span><span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">pos</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">&amp;</span> <span class="identifier">front</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">&amp;</span> <span class="identifier">back</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">data</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span>
+</pre>
+<p>
+ Modifying the <code class="computeroutput"><span class="identifier">string_ref</span></code> (but
+ not the underlying data):
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">clear</span><span class="special">();</span>
+<span class="keyword">void</span> <span class="identifier">remove_prefix</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span>
+<span class="keyword">void</span> <span class="identifier">remove_suffix</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span>
+</pre>
+<p>
+ Searching:
+ </p>
+<pre class="programlisting"><span class="identifier">size_type</span> <span class="identifier">find</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">rfind</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">rfind</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_first_of</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_last_of</span> <span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+
+<span class="identifier">size_type</span> <span class="identifier">find_first_of</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_last_of</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_first_not_of</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_first_not_of</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_last_not_of</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">s</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="identifier">size_type</span> <span class="identifier">find_last_not_of</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+</pre>
+<p>
+ String-like operations:
+ </p>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">basic_string_ref</span> <span class="identifier">substr</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">pos</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">=</span><span class="identifier">npos</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span> <span class="comment">// Creates a new string_ref</span>
+<span class="keyword">bool</span> <span class="identifier">starts_with</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="keyword">bool</span> <span class="identifier">starts_with</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="keyword">bool</span> <span class="identifier">ends_with</span><span class="special">(</span><span class="identifier">charT</span> <span class="identifier">c</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+<span class="keyword">bool</span> <span class="identifier">ends_with</span><span class="special">(</span><span class="identifier">basic_string_ref</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="string_ref.history"></a><a class="link" href="string_ref.html#string_ref.history" title="History">History</a>
+</h2></div></div></div>
+<h4>
+<a name="string_ref.history.h0"></a>
+ <span class="phrase"><a name="string_ref.history.boost_1_53"></a></span><a class="link" href="string_ref.html#string_ref.history.boost_1_53">boost
+ 1.53</a>
+ </h4>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ Introduced
+ </li></ul></div>
+</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: October 30, 2014 at 10:17:16 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
diff --git a/libs/utility/doc/string_ref.qbk b/libs/utility/doc/string_ref.qbk
new file mode 100644
index 0000000000..4c6fc79212
--- /dev/null
+++ b/libs/utility/doc/string_ref.qbk
@@ -0,0 +1,167 @@
+[/
+ / Copyright (c) 2012 Marshall Clow
+ /
+ / 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 String_Ref
+ [quickbook 1.5]
+ [authors [Clow, Marshall]]
+ [copyright 2012 Marshall Clow]
+ [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]
+[/===============]
+
+Boost.StringRef is an implementation of Jeffrey Yaskin's [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html N3442:
+string_ref: a non-owning reference to a string].
+
+When you are parsing/processing strings from some external source, frequently you want to pass a piece of text to a procedure for specialized processing. The canonical way to do this is as a `std::string`, but that has certain drawbacks:
+
+1) If you are processing a buffer of text (say a HTTP response or the contents of a file), then you have to create the string from the text you want to pass, which involves memory allocation and copying of data.
+
+2) if a routine receives a constant `std::string` and wants to pass a portion of that string to another routine, then it must create a new string of that substring.
+
+3) A routine receives a constant `std::string` and wants to return a portion of the string, then it must create a new string to return.
+
+`string_ref` is designed to solve these efficiency problems. A `string_ref` is a read-only reference to a contiguous sequence of characters, and provides much of the functionality of `std::string`. A `string_ref` is cheap to create, copy and pass by value, because it does not actually own the storage that it points to.
+
+A `string_ref` is implemented as a small struct that contains a pointer to the start of the character data and a count. A `string_ref` is cheap to create and cheap to copy.
+
+`string_ref` acts as a container; it includes all the methods that you would expect in a container, including iteration support, `operator []`, `at` and `size`. It can be used with any of the iterator-based algorithms in the STL - as long as you don't need to change the underlying data (`sort` and `remove`, for example, will not work)
+
+Besides generic container functionality, `string_ref` provides a subset of the interface of `std::string`. This makes it easy to replace parameters of type `const std::string &` with `boost::string_ref`. Like `std::string`, `string_ref` has a static member variable named `npos` to denote the result of failed searches, and to mean "the end".
+
+Because a `string_ref` does not own the data that it "points to", it introduces lifetime issues into code that uses it. The programmer must ensure that the data that a `string_ref` refers to exists as long as the `string_ref` does.
+
+[endsect]
+
+
+[/===============]
+[section Examples]
+[/===============]
+
+Integrating `string_ref` into your code is fairly simple. Wherever you pass a `const std::string &` or `std::string` as a parameter, that's a candidate for passing a `boost::string_ref`.
+
+ std::string extract_part ( const std::string &bar ) {
+ return bar.substr ( 2, 3 );
+ }
+
+ if ( extract_part ( "ABCDEFG" ).front() == 'C' ) { /* do something */ }
+
+Let's figure out what happens in this (contrived) example.
+
+First, a temporary string is created from the string literal `"ABCDEFG"`, and it is passed (by reference) to the routine `extract_part`. Then a second string is created in the call `std::string::substr` and returned to `extract_part` (this copy may be elided by RVO). Then `extract_part` returns that string back to the caller (again this copy may be elided). The first temporary string is deallocated, and `front` is called on the second string, and then it is deallocated as well.
+
+Two `std::string`s are created, and two copy operations. That's (potentially) four memory allocations and deallocations, and the associated copying of data.
+
+Now let's look at the same code with `string_ref`:
+
+ boost::string_ref extract_part ( boost::string_ref bar ) {
+ return bar.substr ( 2, 3 );
+ }
+
+ if ( extract_part ( "ABCDEFG" ).front() == "C" ) { /* do something */ }
+
+No memory allocations. No copying of character data. No changes to the code other than the types. There are two `string_ref`s created, and two `string_ref`s copied, but those are cheap operations.
+
+[endsect]
+
+
+[/=================]
+[section:reference Reference ]
+[/=================]
+
+The header file "string_ref.hpp" defines a template `boost::basic_string_ref`, and four specializations - for `char` / `wchar_t` / `char16_t` / `char32_t` .
+
+`#include <boost/utility/string_ref.hpp>`
+
+Construction and copying:
+
+ BOOST_CONSTEXPR basic_string_ref (); // Constructs an empty string_ref
+ BOOST_CONSTEXPR basic_string_ref(const charT* str); // Constructs from a NULL-terminated string
+ BOOST_CONSTEXPR basic_string_ref(const charT* str, size_type len); // Constructs from a pointer, length pair
+ template<typename Allocator>
+ basic_string_ref(const std::basic_string<charT, traits, Allocator>& str); // Constructs from a std::string
+ basic_string_ref (const basic_string_ref &rhs);
+ basic_string_ref& operator=(const basic_string_ref &rhs);
+
+`string_ref` does not define a move constructor nor a move-assignment operator because copying a `string_ref` is just a cheap as moving one.
+
+Basic container-like functions:
+
+ BOOST_CONSTEXPR size_type size() const ;
+ BOOST_CONSTEXPR size_type length() const ;
+ BOOST_CONSTEXPR size_type max_size() const ;
+ BOOST_CONSTEXPR bool empty() const ;
+
+ // All iterators are const_iterators
+ BOOST_CONSTEXPR const_iterator begin() const ;
+ BOOST_CONSTEXPR const_iterator cbegin() const ;
+ BOOST_CONSTEXPR const_iterator end() const ;
+ BOOST_CONSTEXPR const_iterator cend() const ;
+ const_reverse_iterator rbegin() const ;
+ const_reverse_iterator crbegin() const ;
+ const_reverse_iterator rend() const ;
+ const_reverse_iterator crend() const ;
+
+Access to the individual elements (all of which are const):
+
+ BOOST_CONSTEXPR const charT& operator[](size_type pos) const ;
+ const charT& at(size_t pos) const ;
+ BOOST_CONSTEXPR const charT& front() const ;
+ BOOST_CONSTEXPR const charT& back() const ;
+ BOOST_CONSTEXPR const charT* data() const ;
+
+Modifying the `string_ref` (but not the underlying data):
+
+ void clear();
+ void remove_prefix(size_type n);
+ void remove_suffix(size_type n);
+
+Searching:
+
+ size_type find(basic_string_ref s) const ;
+ size_type find(charT c) const ;
+ size_type rfind(basic_string_ref s) const ;
+ size_type rfind(charT c) const ;
+ size_type find_first_of(charT c) const ;
+ size_type find_last_of (charT c) const ;
+
+ size_type find_first_of(basic_string_ref s) const ;
+ size_type find_last_of(basic_string_ref s) const ;
+ size_type find_first_not_of(basic_string_ref s) const ;
+ size_type find_first_not_of(charT c) const ;
+ size_type find_last_not_of(basic_string_ref s) const ;
+ size_type find_last_not_of(charT c) const ;
+
+String-like operations:
+
+ BOOST_CONSTEXPR basic_string_ref substr(size_type pos, size_type n=npos) const ; // Creates a new string_ref
+ bool starts_with(charT c) const ;
+ bool starts_with(basic_string_ref x) const ;
+ bool ends_with(charT c) const ;
+ bool ends_with(basic_string_ref x) const ;
+
+[endsect]
+
+[/===============]
+[section History]
+[/===============]
+
+[heading boost 1.53]
+* Introduced
+
+
+[endsect]
+
+
+
+
diff --git a/libs/utility/enable_if.html b/libs/utility/enable_if.html
index 8ea33bb120..0cd1a985ae 100644
--- a/libs/utility/enable_if.html
+++ b/libs/utility/enable_if.html
@@ -1,464 +1,15 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
- "http://www.w3.org/TR/REC-html40/loose.dtd">
-<HTML>
-<HEAD><TITLE>enable_if</TITLE>
-
-<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<META name="GENERATOR" content="Microsoft FrontPage 5.0">
-</HEAD>
-<BODY >
-<!--HEVEA command line is: hevea -nosymb -noiso -pedantic -v enable_if_docs_for_boost.tex -->
-<!--HTMLHEAD-->
-<!--ENDHTML-->
-<!--PREFIX <ARG ></ARG>-->
-<!--CUT DEF section 1 -->
-<BR>
-<BR>
-
-
-<h1>
-<img border="0" src="../../boost.png" align="center" width="277" height="86">enable_if</h1>
-<BR>
-<BR>
-Copyright 2003 Jaakko J&auml;rvi, Jeremiah Willcock, Andrew Lumsdaine.<BR>
-Copyright 2011 Matt Calabrese.<BR>
-<BR>
-<!--TOC section Introduction-->
-
-<H2><A NAME="htoc1">1</A>&nbsp;&nbsp;Introduction</H2><!--SEC END -->
-
-<A NAME="introduction"></A>
-The <TT>enable_if</TT> family of templates is a set of tools to allow a function template or a class template specialization
-to include or exclude itself from a set of matching functions or specializations
-based on properties of its template arguments.
-For example, one can define function templates that
-are only enabled for, and thus only match, an arbitrary set of types
-defined by a traits class. The <TT>enable_if</TT> templates can also be
-applied to enable class template specializations. Applications of
-<TT>enable_if</TT> are discussed in length
-in&nbsp;[<A HREF="#jarvi:03:cuj_arbitrary_overloading"><CITE>1</CITE></A>] and&nbsp;[<A HREF="#jarvi:03:c++typeclasses"><CITE>2</CITE></A>].<BR>
-<BR>
-<!--TOC subsection Synopsis-->
-
-<H3><A NAME="htoc2">1.1</A>&nbsp;&nbsp;Synopsis</H3><!--SEC END -->
-
-<A NAME="sec:synopsis"></A>
-<PRE>namespace boost {
- template &lt;class Cond, class T = void&gt; struct enable_if;
- template &lt;class Cond, class T = void&gt; struct disable_if;
- template &lt;class Cond, class T&gt; struct lazy_enable_if;
- template &lt;class Cond, class T&gt; struct lazy_disable_if;
-
- template &lt;bool B, class T = void&gt; struct enable_if_c;
- template &lt;bool B, class T = void&gt; struct disable_if_c;
- template &lt;bool B, class T&gt; struct lazy_enable_if_c;
- template &lt;bool B, class T&gt; struct lazy_disable_if_c;
-}
-</PRE>
-<!--TOC subsection Background-->
-
-<H3><A NAME="htoc3">1.2</A>&nbsp;&nbsp;Background</H3><!--SEC END -->
-
-<A NAME="sec:background"></A>
-Sensible operation of template function overloading in C++ relies
-on the <EM>SFINAE</EM> (substitution-failure-is-not-an-error)
-principle&nbsp;[<A HREF="#vandevoorde2002:templates"><CITE>3</CITE></A>]: if an invalid argument
-or return type is formed during the instantiation of a function
-template, the instantiation is removed from the overload resolution
-set instead of causing a compilation error. The following example,
-taken from&nbsp;[<A HREF="#jarvi:03:cuj_arbitrary_overloading"><CITE>1</CITE></A>],
-demonstrates why this is important:
-<PRE>int negate(int i) { return -i; }
-
-template &lt;class F&gt;
-typename F::result_type negate(const F&amp; f) { return -f(); }
-
-</PRE>
-Suppose the compiler encounters the call <TT>negate(1)</TT>. The first
-definition is obviously a better match, but the compiler must
-nevertheless consider (and instantiate the prototypes) of both
-definitions to find this out. Instantiating the latter definition with
-<TT>F</TT> as <TT>int</TT> would result in:
-<PRE>int::result_type negate(const int&amp;);
-
-</PRE>
-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>
-<BR>
-The <TT>enable_if</TT> templates are tools for controlled creation of the SFINAE
-conditions.<BR>
-<BR>
-<!--TOC section The <TT>enable_if</TT> templates-->
-
-<H2><A NAME="htoc4">2</A>&nbsp;&nbsp;The <TT>enable_if</TT> templates</H2><!--SEC END -->
-
-<A NAME="enable_if"></A>
-The names of the <TT>enable_if</TT> templates have three parts: an optional <TT>lazy_</TT> tag,
-either <TT>enable_if</TT> or <TT>disable_if</TT>, and an optional <TT>_c</TT> tag.
-All eight combinations of these parts are supported.
-The meaning of the <TT>lazy_</TT> tag is described in Section&nbsp;<A HREF="#sec:enable_if_lazy">3.3</A>.
-The second part of the name indicates whether a true condition argument should
-enable or disable the current overload.
-The third part of the name indicates whether the condition argument is a <TT>bool</TT> value
-(<TT>_c</TT> suffix), or a type containing a static <TT>bool</TT> constant named <TT>value</TT> (no suffix).
-The latter version interoperates with Boost.MPL. <BR>
-<BR>
-The definitions of <TT>enable_if_c</TT> and <TT>enable_if</TT> are as follows (we use <TT>enable_if</TT> templates
-unqualified but they are in the <TT>boost</TT> namespace).
-<PRE>template &lt;bool B, class T = void&gt;
-struct enable_if_c {
- typedef T type;
-};
-
-template &lt;class T&gt;
-struct enable_if_c&lt;false, T&gt; {};
-
-template &lt;class Cond, class T = void&gt;
-struct enable_if : public enable_if_c&lt;Cond::value, T&gt; {};
-
-</PRE>
-An instantiation of the <TT>enable_if_c</TT> template with the parameter
-<TT>B</TT> as <TT>true</TT> contains a member type <TT>type</TT>, defined
-to be <TT>T</TT>. If <TT>B</TT> is
-<TT>false</TT>, no such member is defined. Thus
-<TT>enable_if_c&lt;B, T&gt;::type</TT> is either a valid or an invalid type
-expression, depending on the value of <TT>B</TT>.
-When valid, <TT>enable_if_c&lt;B, T&gt;::type</TT> equals <TT>T</TT>.
-The <TT>enable_if_c</TT> template can thus be used for controlling when functions are considered for
-overload resolution and when they are not.
-For example, the following function is defined for all arithmetic types (according to the
-classification of the <A HREF="../type_traits/index.html">Boost type_traits library</A>):
-<PRE>template &lt;class T&gt;
-typename enable_if_c&lt;boost::is_arithmetic&lt;T&gt;::value, T&gt;::type
-foo(T t) { return t; }
-
-</PRE>
-The <TT>disable_if_c</TT> template is provided as well, and has the
-same functionality as <TT>enable_if_c</TT> except for the negated condition. The following
-function is enabled for all non-arithmetic types.
-<PRE>template &lt;class T&gt;
-typename disable_if_c&lt;boost::is_arithmetic&lt;T&gt;::value, T&gt;::type
-bar(T t) { return t; }
-
-</PRE>
-For easier syntax in some cases and interoperation with Boost.MPL we provide versions of
-the <TT>enable_if</TT> templates taking any type with a <TT>bool</TT> member constant named
-<TT>value</TT> as the condition argument.
-The MPL <TT>bool_</TT>, <TT>and_</TT>, <TT>or_</TT>, and <TT>not_</TT> templates are likely to be
-useful for creating such types. Also, the traits classes in the Boost.Type_traits library
-follow this convention.
-For example, the above example function <TT>foo</TT> can be alternatively written as:
-<PRE>template &lt;class T&gt;
-typename enable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
-foo(T t) { return t; }
-
-</PRE>
-
-<!--TOC section Using <TT>enable_if</TT>-->
-
-<H2><A NAME="htoc5">3</A>&nbsp;&nbsp;Using <TT>enable_if</TT></H2><!--SEC END -->
-
-<A NAME="sec:using_enable_if"></A>
-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>
-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 &lt;class T&gt;
-T foo(T t, typename enable_if&lt;boost::is_arithmetic&lt;T&gt; &gt;::type* dummy = 0);
-
-</PRE>Hence, an extra parameter of type <TT>void*</TT> is added, but it is given
-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>
-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>
-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>&nbsp;&nbsp;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 &lt;boost/type_traits/is_arithmetic.hpp&gt;
-#include &lt;boost/type_traits/is_pointer.hpp&gt;
-#include &lt;boost/utility/enable_if.hpp&gt;
-
-class test
-{
-public:
- // A constructor that works for any argument list of size 10
- template&lt; class... T
- , typename boost::enable_if_c&lt; sizeof...( T ) == 10, int &gt;::type = 0
- &gt;
- test( T&amp;&amp;... );
-
- // A conversion operation that can convert to any arithmetic type
- template&lt; class T
- , typename boost::enable_if&lt; boost::is_arithmetic&lt; T &gt;, int &gt;::type = 0
- &gt;
- operator T() const;
-
- // A conversion operation that can convert to any pointer type
- template&lt; class T
- , typename boost::enable_if&lt; boost::is_pointer&lt; T &gt;, int &gt;::type = 0
- &gt;
- 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="htoc7">3.2</A>&nbsp;&nbsp;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>.
-One extra template parameter needs to be added for the enabler expressions.
-This parameter has the default value <TT>void</TT>.
-For example:
-<PRE>template &lt;class T, class Enable = void&gt;
-class A { ... };
-
-template &lt;class T&gt;
-class A&lt;T, typename enable_if&lt;is_integral&lt;T&gt; &gt;::type&gt; { ... };
-
-template &lt;class T&gt;
-class A&lt;T, typename enable_if&lt;is_float&lt;T&gt; &gt;::type&gt; { ... };
-
-</PRE>Instantiating <TT>A</TT> with any integral type matches the first specialization,
-whereas any floating point type matches the second one. All other types
-match the primary template.
-The condition can be any compile-time boolean expression that depends on the
-template arguments of the class.
-Note that again, the second argument to <TT>enable_if</TT> is not needed; the default (<TT>void</TT>)
-is the correct value.<BR>
-<BR>
-<!--TOC subsection Overlapping enabler conditions-->
-
-<H3><A NAME="htoc8">3.3</A>&nbsp;&nbsp;Overlapping enabler conditions</H3><!--SEC END -->
-
-<A NAME="sec:overlapping_conditions"></A>
-Once the compiler has examined the enabling conditions and included the
-function into the overload resolution set, normal C++ overload resolution
-rules are used to select the best matching function.
-In particular, there is no ordering between enabling conditions.
-Function templates with enabling conditions that are not mutually exclusive can
-lead to ambiguities. For example:
-<PRE>template &lt;class T&gt;
-typename enable_if&lt;boost::is_integral&lt;T&gt;, void&gt;::type
-foo(T t) {}
-
-template &lt;class T&gt;
-typename enable_if&lt;boost::is_arithmetic&lt;T&gt;, void&gt;::type
-foo(T t) {}
-
-</PRE>
-All integral types are also arithmetic. Therefore, say, for the call <TT>foo(1)</TT>,
-both conditions are true and both functions are thus in the overload resolution set.
-They are both equally good matches and thus ambiguous.
-Of course, more than one enabling condition can be simultaneously true as long as
-other arguments disambiguate the functions.<BR>
-<BR>
-The above discussion applies to using <TT>enable_if</TT> in class template
-partial specializations as well.<BR>
-<BR>
-<!--TOC subsection Lazy <TT>enable_if</TT>-->
-
-<H3><A NAME="htoc9">3.4</A>&nbsp;&nbsp;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
-function signature unless an enabling condition is true. For example:
-<PRE>template &lt;class T, class U&gt; class mult_traits;
-
-template &lt;class T, class U&gt;
-typename enable_if&lt;is_multipliable&lt;T, U&gt;, typename mult_traits&lt;T, U&gt;::type&gt;::type
-operator*(const T&amp; t, const U&amp; u) { ... }
-
-</PRE>Assume the class template <TT>mult_traits</TT> is a traits class defining
-the resulting type of a multiplication operator. The <TT>is_multipliable</TT> traits
-class specifies for which types to enable the operator. Whenever
-<TT>is_multipliable&lt;A, B&gt;::value</TT> is <TT>true</TT> for some types <TT>A</TT> and <TT>B</TT>,
-then <TT>mult_traits&lt;A, B&gt;::type</TT> is defined.<BR>
-<BR>
-Now, trying to invoke (some other overload) of <TT>operator*</TT> with, say, operand types <TT>C</TT> and <TT>D</TT>
-for which <TT>is_multipliable&lt;C, D&gt;::value</TT> is <TT>false</TT>
-and <TT>mult_traits&lt;C, D&gt;::type</TT> is not defined is an error on some compilers.
-The SFINAE principle is not applied because
-the invalid type occurs as an argument to another template. The <TT>lazy_enable_if</TT>
-and <TT>lazy_disable_if</TT> templates (and their <TT>_c</TT> versions) can be used in such
-situations:
-<PRE>template&lt;class T, class U&gt;
-typename lazy_enable_if&lt;is_multipliable&lt;T, U&gt;, mult_traits&lt;T, U&gt; &gt;::type
-operator*(const T&amp; t, const U&amp; u) { ... }
-
-</PRE>The second argument of <TT>lazy_enable_if</TT> must be a class type
-that defines a nested type named <TT>type</TT> whenever the first
-parameter (the condition) is true.<BR>
-<BR>
-<!--TOC paragraph Note-->
-
-<H5>Note</H5><!--SEC END -->
-
-Referring to one member type or static constant in a traits class
-causes all of the members (type and static constant) of that
-specialization to be instantiated. Therefore, if your traits classes
-can sometimes contain invalid types, you should use two distinct
-templates for describing the conditions and the type mappings. In the
-above example, <TT>is_multipliable&lt;T, U&gt;::value</TT> defines when
-<TT>mult_traits&lt;T, U&gt;::type</TT> is valid.<BR>
-<BR>
-<!--TOC subsection Compiler workarounds-->
-
-<H3><A NAME="htoc10">3.5</A>&nbsp;&nbsp;Compiler workarounds</H3><!--SEC END -->
-
-<A NAME="sec:workarounds"></A>
-Some compilers flag functions as ambiguous if the only distinguishing factor is a different
-condition in an enabler (even though the functions could never be ambiguous). For example,
-some compilers (e.g. GCC 3.2) diagnose the following two functions as ambiguous:
-<PRE>template &lt;class T&gt;
-typename enable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
-foo(T t);
-
-template &lt;class T&gt;
-typename disable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
-foo(T t);
-
-</PRE>Two workarounds can be applied:
-<UL><LI>
-Use an extra dummy parameter which disambiguates the functions. Use a default value for
-it to hide the parameter from the caller. For example:
-<PRE>template &lt;int&gt; struct dummy { dummy(int) {} };
-
-template &lt;class T&gt;
-typename enable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
-foo(T t, dummy&lt;0&gt; = 0);
-
-template &lt;class T&gt;
-typename disable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
-foo(T t, dummy&lt;1&gt; = 0);
-</PRE><BR>
-<BR>
-<LI>Define the functions in different namespaces and bring them into a common
-namespace with <TT>using</TT> declarations:
-<PRE>namespace A {
- template &lt;class T&gt;
- typename enable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
- foo(T t);
-}
-
-namespace B {
- template &lt;class T&gt;
- typename disable_if&lt;boost::is_arithmetic&lt;T&gt;, T&gt;::type
- foo(T t);
-}
-
-using A::foo;
-using B::foo;
-
-</PRE>
-Note that the second workaround above cannot be used for member
-templates. On the other hand, operators do not accept extra arguments,
-which makes the first workaround unusable. As the net effect,
-neither of the workarounds are of assistance for templated operators that
-need to be defined as member functions (assignment and
-subscript operators).
-</UL>
-<!--TOC section Acknowledgements-->
-
-<H2><A NAME="htoc10">4</A>&nbsp;&nbsp;Acknowledgements</H2><!--SEC END -->
-
-We are grateful to Howard Hinnant, Jason Shirk, Paul Mensonides, and Richard
-Smith whose findings have influenced the library.<BR>
-<BR>
-<!--TOC section References-->
-
-<H2>References</H2><!--SEC END -->
-<DL COMPACT=compact><DT><A NAME="jarvi:03:cuj_arbitrary_overloading"><FONT COLOR=purple>[1]</FONT></A><DD>
-Jaakko J&auml;rvi, Jeremiah Willcock, Howard Hinnant, and Andrew Lumsdaine.
-Function overloading based on arbitrary properties of types.
-<EM>C/C++ Users Journal</EM>, 21(6):25--32, June 2003.<BR>
-<BR>
-<DT><A NAME="jarvi:03:c++typeclasses"><FONT COLOR=purple>[2]</FONT></A><DD>
-Jaakko J&auml;rvi, Jeremiah Willcock, and Andrew Lumsdaine.
-Concept-controlled polymorphism.
-In Frank Pfennig and Yannis Smaragdakis, editors, <EM>Generative
- Programming and Component Engineering</EM>, volume 2830 of <EM>LNCS</EM>, pages
- 228--244. Springer Verlag, September 2003.<BR>
-<BR>
-<DT><A NAME="vandevoorde2002:templates"><FONT COLOR=purple>[3]</FONT></A><DD>
-David Vandevoorde and Nicolai&nbsp;M. Josuttis.
-<EM>C++ Templates: The Complete Guide</EM>.
-Addison-Wesley, 2002.</DL>
-
-<hr/>
- <p>Copyright Jaakko J&auml;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-->
-<HR SIZE=2>
-<BLOCKQUOTE><EM>This document was translated from L<sup>A</sup>T<sub>E</sub>X by
-</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>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv=refresh content="0; URL=../core/doc/html/core/enable_if.html">
+<title>Automatic redirection</title>
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../core/doc/html/core/enable_if.html">enable_if.html</a>.&nbsp;<hr>
+<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 <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
+</html>
diff --git a/libs/utility/enable_if/test/Jamfile.v2 b/libs/utility/enable_if/test/Jamfile.v2
deleted file mode 100644
index 77a87986c4..0000000000
--- a/libs/utility/enable_if/test/Jamfile.v2
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright David Abrahams 2003.
-# 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/
-
-project
- : requirements <library>/boost/test//boost_test_exec_monitor
- ;
-
-test-suite utility/enable_if
- :
- [ run constructors.cpp ]
- [ run dummy_arg_disambiguation.cpp ]
- [ run lazy.cpp ]
- [ run lazy_test.cpp ]
- [ run member_templates.cpp ]
- [ run namespace_disambiguation.cpp ]
- [ run no_disambiguation.cpp ]
- [ run partial_specializations.cpp ]
- ;
-
diff --git a/libs/utility/enable_if/test/constructors.cpp b/libs/utility/enable_if/test/constructors.cpp
deleted file mode 100644
index 0d465de86d..0000000000
--- a/libs/utility/enable_if/test/constructors.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits.hpp>
-
-using boost::enable_if;
-using boost::disable_if;
-using boost::is_arithmetic;
-
-struct container {
- bool my_value;
-
- template <class T>
- container(const T&, const typename enable_if<is_arithmetic<T>, T>::type * = 0):
- my_value(true) {}
-
- template <class T>
- container(const T&, const typename disable_if<is_arithmetic<T>, T>::type * = 0):
- my_value(false) {}
-};
-
-// example from Howard Hinnant (tests enable_if template members of a templated class)
-template <class charT>
-struct xstring
-{
- template <class It>
- xstring(It begin, It end, typename
- disable_if<is_arithmetic<It> >::type* = 0)
- : data(end-begin) {}
-
- int data;
-};
-
-
-int test_main(int, char*[])
-{
-
- BOOST_CHECK(container(1).my_value);
- BOOST_CHECK(container(1.0).my_value);
-
- BOOST_CHECK(!container("1").my_value);
- BOOST_CHECK(!container(static_cast<void*>(0)).my_value);
-
- char sa[] = "123456";
- BOOST_CHECK(xstring<char>(sa, sa+6).data == 6);
-
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/dummy_arg_disambiguation.cpp b/libs/utility/enable_if/test/dummy_arg_disambiguation.cpp
deleted file mode 100644
index 60dfdfdeed..0000000000
--- a/libs/utility/enable_if/test/dummy_arg_disambiguation.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-
-using boost::enable_if;
-using boost::disable_if;
-using boost::is_arithmetic;
-
-template <int N> struct dummy {
- dummy(int) {};
-};
-
-template<class T>
-typename enable_if<is_arithmetic<T>, bool>::type
-arithmetic_object(T t, dummy<0> = 0) { return true; }
-
-template<class T>
-typename disable_if<is_arithmetic<T>, bool>::type
-arithmetic_object(T t, dummy<1> = 0) { return false; }
-
-
-int test_main(int, char*[])
-{
-
- BOOST_CHECK(arithmetic_object(1));
- BOOST_CHECK(arithmetic_object(1.0));
-
- BOOST_CHECK(!arithmetic_object("1"));
- BOOST_CHECK(!arithmetic_object(static_cast<void*>(0)));
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/lazy.cpp b/libs/utility/enable_if/test/lazy.cpp
deleted file mode 100644
index f04111e76b..0000000000
--- a/libs/utility/enable_if/test/lazy.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-using boost::enable_if_c;
-using boost::lazy_enable_if_c;
-
-// This class provides a reduced example of a traits class for
-// computing the result of multiplying two types. The member typedef
-// 'type' in this traits class defines the return type of this
-// operator. The return type member is invalid unless both arguments
-// for mult_traits are values that mult_traits expects (ints in this
-// case). This kind of situation may arise if a traits class only
-// makes sense for some set of types, not all C++ types.
-
-template <class T> struct is_int {
- BOOST_STATIC_CONSTANT(bool, value = (boost::is_same<T, int>::value));
-};
-
-template <class T, class U>
-struct mult_traits {
- typedef typename T::does_not_exist type;
-};
-
-template <>
-struct mult_traits<int, int> {
- typedef int type;
-};
-
-
-// Next, a forwarding function mult() is defined. It is enabled only
-// when both arguments are of type int. The first version, using
-// non-lazy enable_if_c does not work.
-
-#if 0
-template <class T, class U>
-typename enable_if_c<
- is_int<T>::value && is_int<U>::value,
- typename mult_traits<T, U>::type
->::type
-mult(const T& x, const U& y) {return x * y;}
-#endif
-
-// A correct version uses lazy_enable_if_c.
-// This template removes compiler errors from invalid code used as an
-// argument to enable_if_c.
-
-#if 1
-template <class T, class U>
-typename lazy_enable_if_c<
- is_int<T>::value & is_int<U>::value,
- mult_traits<T, U>
->::type
-mult(const T& x, const U& y) {return x * y;}
-#endif
-
-double mult(int i, double d) { return (double)i * d; }
-
-int test_main(int, char*[])
-{
-
-
- BOOST_CHECK(mult(1, 2) == 2);
-
- BOOST_CHECK(mult(1, 3.0) == 3.0);
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/lazy_test.cpp b/libs/utility/enable_if/test/lazy_test.cpp
deleted file mode 100644
index 9ec53245c0..0000000000
--- a/libs/utility/enable_if/test/lazy_test.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-// Testing all variations of lazy_enable_if.
-
-#include <boost/test/minimal.hpp>
-#include <boost/mpl/not.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-using boost::lazy_enable_if;
-using boost::lazy_disable_if;
-
-using boost::lazy_enable_if_c;
-using boost::lazy_disable_if_c;
-
-
-template <class T>
-struct is_int_or_double {
- BOOST_STATIC_CONSTANT(bool,
- value = (boost::is_same<T, int>::value ||
- boost::is_same<T, double>::value));
-};
-
-template <class T>
-struct some_traits {
- typedef typename T::does_not_exist type;
-};
-
-template <>
-struct some_traits<int> {
- typedef bool type;
-};
-
-template <>
-struct some_traits<double> {
- typedef bool type;
-};
-
-template <class T>
-struct make_bool {
- typedef bool type;
-};
-
-template <>
-struct make_bool<int> {};
-
-template <>
-struct make_bool<double> {};
-
-namespace A {
-
- template<class T>
- typename lazy_enable_if<is_int_or_double<T>, some_traits<T> >::type
- foo(T t) { return true; }
-
- template<class T>
- typename lazy_enable_if_c<is_int_or_double<T>::value, some_traits<T> >::type
- foo2(T t) { return true; }
-}
-
-namespace B {
- template<class T>
- typename lazy_disable_if<is_int_or_double<T>, make_bool<T> >::type
- foo(T t) { return false; }
-
- template<class T>
- typename lazy_disable_if_c<is_int_or_double<T>::value, make_bool<T> >::type
- foo2(T t) { return false; }
-}
-
-int test_main(int, char*[])
-{
- using namespace A;
- using namespace B;
- BOOST_CHECK(foo(1));
- BOOST_CHECK(foo(1.0));
-
- BOOST_CHECK(!foo("1"));
- BOOST_CHECK(!foo(static_cast<void*>(0)));
-
- BOOST_CHECK(foo2(1));
- BOOST_CHECK(foo2(1.0));
-
- BOOST_CHECK(!foo2("1"));
- BOOST_CHECK(!foo2(static_cast<void*>(0)));
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/member_templates.cpp b/libs/utility/enable_if/test/member_templates.cpp
deleted file mode 100644
index 55e2d80137..0000000000
--- a/libs/utility/enable_if/test/member_templates.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-
-using boost::enable_if;
-using boost::disable_if;
-using boost::is_arithmetic;
-
-struct container {
- template <class T>
- typename enable_if<is_arithmetic<T>, bool>::type
- arithmetic_object(const T&, const int* /* disambiguate */ = 0) {return true;}
-
- template <class T>
- typename disable_if<is_arithmetic<T>, bool>::type
- arithmetic_object(const T&) {return false;}
-};
-
-int test_main(int, char*[])
-{
-
- BOOST_CHECK(container().arithmetic_object(1));
- BOOST_CHECK(container().arithmetic_object(1.0));
-
- BOOST_CHECK(!container().arithmetic_object("1"));
- BOOST_CHECK(!container().arithmetic_object(static_cast<void*>(0)));
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/namespace_disambiguation.cpp b/libs/utility/enable_if/test/namespace_disambiguation.cpp
deleted file mode 100644
index 45d4f0a307..0000000000
--- a/libs/utility/enable_if/test/namespace_disambiguation.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-#include <boost/mpl/not.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-
-using boost::enable_if;
-using boost::mpl::not_;
-using boost::is_arithmetic;
-
-namespace A {
- template<class T>
- typename enable_if<is_arithmetic<T>, bool>::type
- arithmetic_object(T t) { return true; }
-}
-
-namespace B {
- template<class T>
- typename enable_if<not_<is_arithmetic<T> >, bool>::type
- arithmetic_object(T t) { return false; }
-}
-
-int test_main(int, char*[])
-{
- using namespace A;
- using namespace B;
- BOOST_CHECK(arithmetic_object(1));
- BOOST_CHECK(arithmetic_object(1.0));
-
- BOOST_CHECK(!arithmetic_object("1"));
- BOOST_CHECK(!arithmetic_object(static_cast<void*>(0)));
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/no_disambiguation.cpp b/libs/utility/enable_if/test/no_disambiguation.cpp
deleted file mode 100644
index e2416ed160..0000000000
--- a/libs/utility/enable_if/test/no_disambiguation.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-#include <boost/mpl/not.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-
-using boost::mpl::not_;
-using boost::enable_if;
-using boost::is_arithmetic;
-
-template<class T>
-typename enable_if<is_arithmetic<T>, bool>::type
-arithmetic_object(T t) { return true; }
-
-template<class T>
-typename enable_if<not_<is_arithmetic<T> >, bool>::type
-arithmetic_object(T t) { return false; }
-
-
-int test_main(int, char*[])
-{
-
- BOOST_CHECK(arithmetic_object(1));
- BOOST_CHECK(arithmetic_object(1.0));
-
- BOOST_CHECK(!arithmetic_object("1"));
- BOOST_CHECK(!arithmetic_object(static_cast<void*>(0)));
-
- return 0;
-}
-
diff --git a/libs/utility/enable_if/test/partial_specializations.cpp b/libs/utility/enable_if/test/partial_specializations.cpp
deleted file mode 100644
index 1d4db996cb..0000000000
--- a/libs/utility/enable_if/test/partial_specializations.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Boost enable_if library
-
-// 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 Jarvi (jajarvi at osl.iu.edu)
-// Jeremiah Willcock (jewillco at osl.iu.edu)
-// Andrew Lumsdaine (lums at osl.iu.edu)
-
-#include <boost/test/minimal.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-
-using boost::enable_if_c;
-using boost::disable_if_c;
-using boost::enable_if;
-using boost::disable_if;
-using boost::is_arithmetic;
-
-template <class T, class Enable = void>
-struct tester;
-
-template <class T>
-struct tester<T, typename enable_if_c<is_arithmetic<T>::value>::type> {
- BOOST_STATIC_CONSTANT(bool, value = true);
-};
-
-template <class T>
-struct tester<T, typename disable_if_c<is_arithmetic<T>::value>::type> {
- BOOST_STATIC_CONSTANT(bool, value = false);
-};
-
-template <class T, class Enable = void>
-struct tester2;
-
-template <class T>
-struct tester2<T, typename enable_if<is_arithmetic<T> >::type> {
- BOOST_STATIC_CONSTANT(bool, value = true);
-};
-
-template <class T>
-struct tester2<T, typename disable_if<is_arithmetic<T> >::type> {
- BOOST_STATIC_CONSTANT(bool, value = false);
-};
-
-int test_main(int, char*[])
-{
-
- BOOST_CHECK(tester<int>::value);
- BOOST_CHECK(tester<double>::value);
-
- BOOST_CHECK(!tester<char*>::value);
- BOOST_CHECK(!tester<void*>::value);
-
- BOOST_CHECK(tester2<int>::value);
- BOOST_CHECK(tester2<double>::value);
-
- BOOST_CHECK(!tester2<char*>::value);
- BOOST_CHECK(!tester2<void*>::value);
-
- return 0;
-}
-
diff --git a/libs/utility/generator_iterator_test.cpp b/libs/utility/generator_iterator_test.cpp
new file mode 100644
index 0000000000..1c7a110407
--- /dev/null
+++ b/libs/utility/generator_iterator_test.cpp
@@ -0,0 +1,63 @@
+//
+// Copyright 2014 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/generator_iterator.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <algorithm>
+
+class X
+{
+private:
+
+ int v;
+
+public:
+
+ typedef int result_type;
+
+ X(): v( 0 )
+ {
+ }
+
+ int operator()()
+ {
+ return ++v;
+ }
+};
+
+template<class InputIterator, class Size, class OutputIterator> OutputIterator copy_n( InputIterator first, Size n, OutputIterator result )
+{
+ while( n-- > 0 )
+ {
+ *result++ = *first++;
+ }
+
+ return result;
+}
+
+void copy_test()
+{
+ X x;
+ boost::generator_iterator<X> in( &x );
+
+ int const N = 4;
+ int v[ N ] = { 0 };
+
+ ::copy_n( in, 4, v );
+
+ BOOST_TEST_EQ( v[0], 1 );
+ BOOST_TEST_EQ( v[1], 2 );
+ BOOST_TEST_EQ( v[2], 3 );
+ BOOST_TEST_EQ( v[3], 4 );
+}
+
+int main()
+{
+ copy_test();
+ return boost::report_errors();
+}
diff --git a/libs/utility/in_place_factories.html b/libs/utility/in_place_factories.html
index f8a4c7bba5..8eb7ea8d41 100644
--- a/libs/utility/in_place_factories.html
+++ b/libs/utility/in_place_factories.html
@@ -46,7 +46,7 @@ HREF="../../boost/utility/typed_in_place_factory.hpp">boost/utility/typed_in_pla
<p>Suppose we have a class</p>
<pre>struct X
{
- X ( int, std:::string ) ;
+ X ( int, std::string ) ;
} ;</pre>
<p>And a container for it which supports an empty state (that is, which can contain zero objects):</p>
<pre>struct C
diff --git a/libs/utility/index.html b/libs/utility/index.html
index d957d79df4..493be93e05 100644
--- a/libs/utility/index.html
+++ b/libs/utility/index.html
@@ -14,21 +14,26 @@
<p>But that doesn't mean there isn't useful stuff here. Take a look:</p>
<blockquote>
<p>
- <a href="assert.html">assert</a><br>
- <a href="base_from_member.html">base_from_member</a><br>
+ <a href="../core/doc/html/core/addressof.html">addressof</a> (moved to the Boost.Core library)<br>
+ <a href="doc/html/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="../core/doc/html/core/checked_delete.html">checked_delete</a> (moved to the Boost.Core library)<br>
+ <a href="doc/html/compressed_pair.html">compressed_pair</a><br>
<a href="doc/html/declval.html">declval</a><br>
- <a href="enable_if.html">enable_if</a><br>
- <a href="iterator_adaptors.htm">iterator_adaptors</a><br>
- <a href="generator_iterator.htm">generator iterator adaptors</a><br>
+ <a href="../core/doc/html/core/enable_if.html">enable_if</a> (moved to the Boost.Core library)<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="../core/doc/html/core/noncopyable.html">noncopyable</a> (moved to the Boost.Core library)<br>
<a href="operators.htm">operators</a><br>
- <a href="swap.html">swap</a><br>
+ <a href="utility.htm#result_of">result_of</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="doc/html/string_ref.html">string_ref</a><br>
+ <a href="value_init.htm">value_init</a><br>
+ </p>
</blockquote>
<hr>
<p>&copy; Copyright Beman Dawes, 2001</p>
@@ -41,4 +46,3 @@
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->07 November, 2006<!--webbot bot="Timestamp" endspan i-checksum="39368" --></p>
</body>
</html>
-
diff --git a/libs/utility/meta/libraries.json b/libs/utility/meta/libraries.json
new file mode 100644
index 0000000000..5674dafc83
--- /dev/null
+++ b/libs/utility/meta/libraries.json
@@ -0,0 +1,113 @@
+[
+ {
+ "key": "utility",
+ "name": "Utility",
+ "authors": [
+ "Dave Abrahams and others"
+ ],
+ "description": "Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.",
+ "documentation": "utility.htm",
+ "category": [
+ "Algorithms",
+ "Function-objects",
+ "Memory",
+ "Miscellaneous",
+ "Patterns"
+ ]
+ },
+ {
+ "key": "utility/call_traits",
+ "name": "Call Traits",
+ "authors": [
+ "John Maddock, Howard Hinnant, et al"
+ ],
+ "description": "Defines types for passing parameters.",
+ "documentation": "call_traits.htm",
+ "category": [
+ "Generic"
+ ]
+ },
+ {
+ "key": "utility/compressed_pair",
+ "name": "Compressed Pair",
+ "authors": [
+ "John Maddock, Howard Hinnant, et al"
+ ],
+ "description": "Empty member optimization.",
+ "documentation": "compressed_pair.htm",
+ "category": [
+ "Data",
+ "Patterns"
+ ]
+ },
+ {
+ "key": "utility/identity_type",
+ "name": "Identity Type",
+ "authors": [
+ "Lorenzo Caminiti"
+ ],
+ "description": "Wrap types within round parenthesis so they can always be passed as macro parameters.",
+ "documentation": "identity_type/",
+ "category": [
+ "Preprocessor"
+ ],
+ "maintainers": [
+ "Lorenzo Caminiti <lorcaminiti -at- gmail.com>"
+ ]
+ },
+ {
+ "key": "utility/in_place_factories",
+ "name": "In Place Factory, Typed In Place Factory",
+ "authors": [
+ "Fernando Cacciola"
+ ],
+ "description": "Generic in-place construction of contained objects with a variadic argument-list.",
+ "documentation": "in_place_factories.html",
+ "category": [
+ "Generic"
+ ]
+ },
+ {
+ "key": "utility/operators",
+ "name": "Operators",
+ "authors": [
+ "Dave Abrahams",
+ "Jeremy Siek"
+ ],
+ "description": "Templates ease arithmetic classes and iterators.",
+ "documentation": "operators.htm",
+ "category": [
+ "Generic",
+ "Iterators",
+ "Math"
+ ],
+ "maintainers": [
+ "Daniel Frey <d.frey -at- gmx.de>"
+ ]
+ },
+ {
+ "key": "utility/result_of",
+ "name": "Result Of",
+ "description": "Determines the type of a function call expression.",
+ "documentation": "utility.htm#result_of",
+ "category": [
+ "Function-objects"
+ ],
+ "authors": "",
+ "maintainers": [
+ "Daniel Walker <daniel.j.walker -at- gmail.com>"
+ ]
+ },
+ {
+ "key": "utility/value_initialized",
+ "name": "Value Initialized",
+ "authors": [
+ "Fernando Cacciola"
+ ],
+ "description": "Wrapper for uniform-syntax value initialization, based on the original idea of David Abrahams.",
+ "documentation": "value_init.htm",
+ "category": [
+ "Miscellaneous"
+ ]
+ }
+]
diff --git a/libs/utility/noncopyable_test.cpp b/libs/utility/noncopyable_test.cpp
deleted file mode 100644
index d5d2994d7e..0000000000
--- a/libs/utility/noncopyable_test.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// boost class noncopyable test program ------------------------------------//
-
-// (C) Copyright Beman Dawes 1999. 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)
-
-// See http://www.boost.org for most recent version including documentation.
-
-// Revision History
-// 9 Jun 99 Add unnamed namespace
-// 2 Jun 99 Initial Version
-
-#include <boost/noncopyable.hpp>
-#include <iostream>
-
-// This program demonstrates compiler errors resulting from trying to copy
-// construct or copy assign a class object derived from class noncopyable.
-
-namespace
-{
- class DontTreadOnMe : private boost::noncopyable
- {
- public:
- DontTreadOnMe() { std::cout << "defanged!" << std::endl; }
- }; // DontTreadOnMe
-
-} // unnamed namespace
-
-int main()
-{
- DontTreadOnMe object1;
- DontTreadOnMe object2(object1);
- object1 = object2;
- return 0;
-} // main
-
diff --git a/libs/utility/numeric_traits_test.cpp b/libs/utility/numeric_traits_test.cpp
index 47ee09d4c3..ffd301c75f 100644
--- a/libs/utility/numeric_traits_test.cpp
+++ b/libs/utility/numeric_traits_test.cpp
@@ -61,18 +61,19 @@ struct complement
typedef complement_traits_aux<Number, size - 1> prev;
public:
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
- // GCC 4.0.2 ICEs on these C-style casts
+ // GCC 4.0.2 ICEs on these C-style casts
BOOST_STATIC_CONSTANT(Number, max =
Number((prev::max) << CHAR_BIT)
+ Number(UCHAR_MAX));
BOOST_STATIC_CONSTANT(Number, min = Number((prev::min) << CHAR_BIT));
#else
+ // Avoid left shifting negative integers, use multiplication instead
+ BOOST_STATIC_CONSTANT(Number, shift = 1u << CHAR_BIT);
BOOST_STATIC_CONSTANT(Number, max =
- Number(Number(prev::max) << CHAR_BIT)
+ Number(Number(prev::max) * shift)
+ Number(UCHAR_MAX));
- BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) << CHAR_BIT));
+ BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) * shift));
#endif
-
};
};
diff --git a/libs/utility/ref_ct_test.cpp b/libs/utility/ref_ct_test.cpp
deleted file mode 100644
index a3b5eeaf3f..0000000000
--- a/libs/utility/ref_ct_test.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright David Abrahams and Aleksey Gurtovoy
-// 2002-2004. 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)
-
-// compile-time test for "boost/ref.hpp" header content
-// see 'ref_test.cpp' for run-time part
-
-#include <boost/ref.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/detail/workaround.hpp>
-
-#include <boost/mpl/assert.hpp>
-
-namespace {
-
-template< typename T, typename U >
-void ref_test(boost::reference_wrapper<U>)
-{
- typedef typename boost::reference_wrapper<U>::type type;
- BOOST_STATIC_ASSERT((boost::is_same<U,type>::value));
- BOOST_STATIC_ASSERT((boost::is_same<T,type>::value));
-}
-
-template< typename T >
-void assignable_test(T x)
-{
- x = x;
-}
-
-template< bool R, typename T >
-void is_reference_wrapper_test(T)
-{
- BOOST_STATIC_ASSERT(boost::is_reference_wrapper<T>::value == R);
-}
-
-template< typename R, typename Ref >
-void cxx_reference_test(Ref)
-{
-#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
- typedef typename boost::remove_const<Ref>::type ref;
- BOOST_STATIC_ASSERT((boost::is_same<R,ref>::value));
-#else
- BOOST_STATIC_ASSERT((boost::is_same<R,Ref>::value));
-#endif
-}
-
-template< typename R, typename Ref >
-void unwrap_reference_test(Ref)
-{
-#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
- typedef typename boost::remove_const<Ref>::type ref;
- typedef typename boost::unwrap_reference<ref>::type type;
-#else
- typedef typename boost::unwrap_reference<Ref>::type type;
-#endif
- BOOST_STATIC_ASSERT((boost::is_same<R,type>::value));
-}
-
-} // namespace
-
-int main()
-{
- int i = 0;
- int& ri = i;
-
- int const ci = 0;
- int const& rci = ci;
-
- // 'ref/cref' functions test
- ref_test<int>(boost::ref(i));
- ref_test<int>(boost::ref(ri));
- ref_test<int const>(boost::ref(ci));
- ref_test<int const>(boost::ref(rci));
-
- ref_test<int const>(boost::cref(i));
- ref_test<int const>(boost::cref(ri));
- ref_test<int const>(boost::cref(ci));
- ref_test<int const>(boost::cref(rci));
-
- // test 'assignable' requirement
- assignable_test(boost::ref(i));
- assignable_test(boost::ref(ri));
- assignable_test(boost::cref(i));
- assignable_test(boost::cref(ci));
- assignable_test(boost::cref(rci));
-
- // 'is_reference_wrapper' test
- is_reference_wrapper_test<true>(boost::ref(i));
- is_reference_wrapper_test<true>(boost::ref(ri));
- is_reference_wrapper_test<true>(boost::cref(i));
- is_reference_wrapper_test<true>(boost::cref(ci));
- is_reference_wrapper_test<true>(boost::cref(rci));
-
- is_reference_wrapper_test<false>(i);
- is_reference_wrapper_test<false, int&>(ri);
- is_reference_wrapper_test<false>(ci);
- is_reference_wrapper_test<false, int const&>(rci);
-
- // ordinary references/function template arguments deduction test
- cxx_reference_test<int>(i);
- cxx_reference_test<int>(ri);
- cxx_reference_test<int>(ci);
- cxx_reference_test<int>(rci);
-
- cxx_reference_test<int&, int&>(i);
- cxx_reference_test<int&, int&>(ri);
- cxx_reference_test<int const&, int const&>(i);
- cxx_reference_test<int const&, int const&>(ri);
- cxx_reference_test<int const&, int const&>(ci);
- cxx_reference_test<int const&, int const&>(rci);
-
- // 'unwrap_reference' test
- unwrap_reference_test<int>(boost::ref(i));
- unwrap_reference_test<int>(boost::ref(ri));
- unwrap_reference_test<int const>(boost::cref(i));
- unwrap_reference_test<int const>(boost::cref(ci));
- unwrap_reference_test<int const>(boost::cref(rci));
-
- unwrap_reference_test<int>(i);
- unwrap_reference_test<int>(ri);
- unwrap_reference_test<int>(ci);
- unwrap_reference_test<int>(rci);
- unwrap_reference_test<int&, int&>(i);
- unwrap_reference_test<int&, int&>(ri);
- unwrap_reference_test<int const&, int const&>(i);
- unwrap_reference_test<int const&, int const&>(ri);
- unwrap_reference_test<int const&, int const&>(ci);
- unwrap_reference_test<int const&, int const&>(rci);
-
- return 0;
-}
diff --git a/libs/utility/ref_test.cpp b/libs/utility/ref_test.cpp
deleted file mode 100644
index 71481fad2f..0000000000
--- a/libs/utility/ref_test.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright David Abrahams and Aleksey Gurtovoy
-// 2002-2004. 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)
-
-// run-time test for "boost/ref.hpp" header content
-// see 'ref_ct_test.cpp' for compile-time part
-
-#if defined(_MSC_VER) && !defined(__ICL)
-# 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
-
-#include <boost/ref.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
-
-
-#define BOOST_INCLUDE_MAIN
-#include <boost/test/test_tools.hpp>
-
-namespace {
-using namespace boost;
-
-template <class T>
-struct ref_wrapper
-{
- // Used to verify implicit conversion
- static T* get_pointer(T& x)
- {
- return &x;
- }
-
- static T const* get_const_pointer(T const& x)
- {
- return &x;
- }
-
- template <class Arg>
- static T* passthru(Arg x)
- {
- return get_pointer(x);
- }
-
- template <class Arg>
- static T const* cref_passthru(Arg x)
- {
- return get_const_pointer(x);
- }
-
- static void test(T x)
- {
- BOOST_CHECK(passthru(ref(x)) == &x);
- BOOST_CHECK(&ref(x).get() == &x);
-
- BOOST_CHECK(cref_passthru(cref(x)) == &x);
- BOOST_CHECK(&cref(x).get() == &x);
- }
-};
-
-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;
-}
diff --git a/libs/utility/swap.html b/libs/utility/swap.html
deleted file mode 100644
index 36f84256a9..0000000000
--- a/libs/utility/swap.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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 &lt;<a href="../../boost/swap.hpp">boost/swap.hpp</a>&gt;
- </h2>
-
- <h1>Swap</h1>
-
- <p>
- <tt>template&lt;class T&gt; void swap(T&amp; <em>left</em>, T&amp; <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&amp;,T&amp;)</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 &#x2012; 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 &lt;<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>&gt;.)
- </p>
-
- </body>
-</html>
diff --git a/libs/utility/swap/test/Jamfile.v2 b/libs/utility/swap/test/Jamfile.v2
deleted file mode 100644
index f5b0d46d54..0000000000
--- a/libs/utility/swap/test/Jamfile.v2
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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 ]
- ;
diff --git a/libs/utility/swap/test/array_of_array_of_class.cpp b/libs/utility/swap/test/array_of_array_of_class.cpp
deleted file mode 100644
index 4f02578591..0000000000
--- a/libs/utility/swap/test/array_of_array_of_class.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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;
-}
diff --git a/libs/utility/swap/test/array_of_array_of_int.cpp b/libs/utility/swap/test/array_of_array_of_int.cpp
deleted file mode 100644
index c1778ec9da..0000000000
--- a/libs/utility/swap/test/array_of_array_of_int.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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;
-}
diff --git a/libs/utility/swap/test/array_of_class.cpp b/libs/utility/swap/test/array_of_class.cpp
deleted file mode 100644
index 356762d9cd..0000000000
--- a/libs/utility/swap/test/array_of_class.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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;
-}
diff --git a/libs/utility/swap/test/array_of_int.cpp b/libs/utility/swap/test/array_of_int.cpp
deleted file mode 100644
index 22a7ddeab8..0000000000
--- a/libs/utility/swap/test/array_of_int.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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;
-}
diff --git a/libs/utility/swap/test/array_of_template.cpp b/libs/utility/swap/test/array_of_template.cpp
deleted file mode 100644
index 8f350ade06..0000000000
--- a/libs/utility/swap/test/array_of_template.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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;
-}
diff --git a/libs/utility/swap/test/lib_header_1.cpp b/libs/utility/swap/test/lib_header_1.cpp
deleted file mode 100644
index 923dea6045..0000000000
--- a/libs/utility/swap/test/lib_header_1.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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>
-
diff --git a/libs/utility/swap/test/lib_header_2.cpp b/libs/utility/swap/test/lib_header_2.cpp
deleted file mode 100644
index e88909dbd4..0000000000
--- a/libs/utility/swap/test/lib_header_2.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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>
-
diff --git a/libs/utility/swap/test/mixed_headers_1.cpp b/libs/utility/swap/test/mixed_headers_1.cpp
deleted file mode 100644
index cdb9fe5202..0000000000
--- a/libs/utility/swap/test/mixed_headers_1.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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>
-
diff --git a/libs/utility/swap/test/mixed_headers_2.cpp b/libs/utility/swap/test/mixed_headers_2.cpp
deleted file mode 100644
index 94e9d87015..0000000000
--- a/libs/utility/swap/test/mixed_headers_2.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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>
-
-
diff --git a/libs/utility/swap/test/no_ambiguity_in_boost.cpp b/libs/utility/swap/test/no_ambiguity_in_boost.cpp
deleted file mode 100644
index e269252654..0000000000
--- a/libs/utility/swap/test/no_ambiguity_in_boost.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/primitive.cpp b/libs/utility/swap/test/primitive.cpp
deleted file mode 100644
index 380edb3489..0000000000
--- a/libs/utility/swap/test/primitive.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/root_header_1.cpp b/libs/utility/swap/test/root_header_1.cpp
deleted file mode 100644
index 575d2cbab4..0000000000
--- a/libs/utility/swap/test/root_header_1.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// 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>
-
diff --git a/libs/utility/swap/test/root_header_2.cpp b/libs/utility/swap/test/root_header_2.cpp
deleted file mode 100644
index d26b3a629d..0000000000
--- a/libs/utility/swap/test/root_header_2.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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>
-
diff --git a/libs/utility/swap/test/specialized_in_boost.cpp b/libs/utility/swap/test/specialized_in_boost.cpp
deleted file mode 100644
index 7b3e12e231..0000000000
--- a/libs/utility/swap/test/specialized_in_boost.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/specialized_in_boost_and_other.cpp b/libs/utility/swap/test/specialized_in_boost_and_other.cpp
deleted file mode 100644
index ba6247f324..0000000000
--- a/libs/utility/swap/test/specialized_in_boost_and_other.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/specialized_in_global.cpp b/libs/utility/swap/test/specialized_in_global.cpp
deleted file mode 100644
index 0a0a029e5c..0000000000
--- a/libs/utility/swap/test/specialized_in_global.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/specialized_in_other.cpp b/libs/utility/swap/test/specialized_in_other.cpp
deleted file mode 100644
index a39896fc1e..0000000000
--- a/libs/utility/swap/test/specialized_in_other.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/specialized_in_std.cpp b/libs/utility/swap/test/specialized_in_std.cpp
deleted file mode 100644
index e31e8507ea..0000000000
--- a/libs/utility/swap/test/specialized_in_std.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_bitset.cpp b/libs/utility/swap/test/std_bitset.cpp
deleted file mode 100644
index c46b6867a9..0000000000
--- a/libs/utility/swap/test/std_bitset.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_dateorder.cpp b/libs/utility/swap/test/std_dateorder.cpp
deleted file mode 100644
index b593f6f519..0000000000
--- a/libs/utility/swap/test/std_dateorder.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_string.cpp b/libs/utility/swap/test/std_string.cpp
deleted file mode 100644
index b7d3d4d42d..0000000000
--- a/libs/utility/swap/test/std_string.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_typeinfo_ptr.cpp b/libs/utility/swap/test/std_typeinfo_ptr.cpp
deleted file mode 100644
index 38e293ad2a..0000000000
--- a/libs/utility/swap/test/std_typeinfo_ptr.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_vector_of_boost.cpp b/libs/utility/swap/test/std_vector_of_boost.cpp
deleted file mode 100644
index b0c6355bc3..0000000000
--- a/libs/utility/swap/test/std_vector_of_boost.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_vector_of_global.cpp b/libs/utility/swap/test/std_vector_of_global.cpp
deleted file mode 100644
index 96a9b6a79a..0000000000
--- a/libs/utility/swap/test/std_vector_of_global.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/std_vector_of_other.cpp b/libs/utility/swap/test/std_vector_of_other.cpp
deleted file mode 100644
index 2176f6e2a1..0000000000
--- a/libs/utility/swap/test/std_vector_of_other.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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;
-}
-
diff --git a/libs/utility/swap/test/swap_test_class.hpp b/libs/utility/swap/test/swap_test_class.hpp
deleted file mode 100644
index a25dbbd810..0000000000
--- a/libs/utility/swap/test/swap_test_class.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// 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
diff --git a/libs/utility/test/Jamfile.v2 b/libs/utility/test/Jamfile.v2
index d3fc34c184..276dc22012 100644
--- a/libs/utility/test/Jamfile.v2
+++ b/libs/utility/test/Jamfile.v2
@@ -8,29 +8,28 @@
# bring in rules for testing
import testing ;
+alias unit_test_framework
+ : # sources
+ /boost//unit_test_framework
+ ;
+
# 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 ../base_from_member_ref_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 ]
- [ run ../current_function_test.cpp : : : <test-info>always_show_run_output ]
[ run ../iterators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ]
[ run next_prior_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ]
- [ compile-fail ../noncopyable_test.cpp ]
[ run ../numeric_traits_test.cpp ]
[ run ../operators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ]
- [ compile ../ref_ct_test.cpp ]
- [ run ../ref_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ]
[ compile result_of_test.cpp ]
[ run ../shared_iterator_test.cpp ]
+ [ run string_ref_test1.cpp unit_test_framework ]
+ [ run string_ref_test2.cpp unit_test_framework ]
+ [ run string_ref_test_io.cpp unit_test_framework ]
[ run ../value_init_test.cpp ]
[ run ../value_init_workaround_test.cpp ]
[ run ../initialized_test.cpp ]
@@ -39,6 +38,7 @@ test-suite utility
[ compile-fail ../value_init_test_fail3.cpp ]
[ compile-fail ../initialized_test_fail1.cpp ]
[ compile-fail ../initialized_test_fail2.cpp ]
- [ run ../verify_test.cpp ]
+
+ [ run ../generator_iterator_test.cpp ]
;
diff --git a/libs/utility/test/next_prior_test.cpp b/libs/utility/test/next_prior_test.cpp
index ebce472ed9..4f9b01a823 100644
--- a/libs/utility/test/next_prior_test.cpp
+++ b/libs/utility/test/next_prior_test.cpp
@@ -66,14 +66,32 @@ bool minus_n_test(RandomAccessIterator first, RandomAccessIterator last, Bidirec
return std::distance(i, last) == std::distance(j, last2);
}
+template<class Iterator, class Distance>
+bool minus_n_unsigned_test(Iterator first, Iterator last, Distance size)
+{
+ Iterator i = boost::prior(last, size);
+ return i == first;
+}
+
int test_main(int, char*[])
{
std::vector<int> x(8);
std::list<int> y(x.begin(), x.end());
+ // Tests with iterators
BOOST_REQUIRE(plus_one_test(x.begin(), x.end(), y.begin()));
BOOST_REQUIRE(plus_n_test(x.begin(), x.end(), y.begin()));
BOOST_REQUIRE(minus_one_test(x.begin(), x.end(), y.end()));
BOOST_REQUIRE(minus_n_test(x.begin(), x.end(), y.end()));
+ BOOST_REQUIRE(minus_n_unsigned_test(x.begin(), x.end(), x.size()));
+ BOOST_REQUIRE(minus_n_unsigned_test(y.begin(), y.end(), y.size()));
+
+ // Tests with integers
+ BOOST_REQUIRE(boost::next(5) == 6);
+ BOOST_REQUIRE(boost::next(5, 7) == 12);
+ BOOST_REQUIRE(boost::prior(5) == 4);
+ BOOST_REQUIRE(boost::prior(5, 7) == -2);
+ BOOST_REQUIRE(boost::prior(5, 7u) == -2);
+
return 0;
}
diff --git a/libs/utility/test/result_of_test.cpp b/libs/utility/test/result_of_test.cpp
index 39f6c3bf6a..9ea72f122a 100644
--- a/libs/utility/test/result_of_test.cpp
+++ b/libs/utility/test/result_of_test.cpp
@@ -5,7 +5,13 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#define BOOST_RESULT_OF_USE_DECLTYPE
+// Examples:
+// To run the default test:
+// $ cd libs/utility/test && bjam
+// To test decltype on g++ 2.7:
+// $ cd libs/utility/test && bjam cxxflags="-std=c++11 -D BOOST_RESULT_OF_USE_DECLTYPE"
+
+#include <boost/config.hpp>
// For more information, see http://www.boost.org/libs/utility
#include <boost/utility/result_of.hpp>
@@ -62,6 +68,9 @@ struct int_result_type_and_float_result_of_and_char_return_template
char operator()(char);
};
+template<typename T>
+struct cv_overload_check {};
+
struct result_of_member_function_template
{
template<typename F> struct result;
@@ -69,13 +78,13 @@ struct result_of_member_function_template
template<typename This, typename That> struct result<This(That)> { typedef That type; };
template<class T> typename result<result_of_member_function_template(T)>::type operator()(T);
- template<typename This, typename That> struct result<const This(That)> { typedef const That type; };
+ template<typename This, typename That> struct result<const This(That)> { typedef cv_overload_check<const That> type; };
template<class T> typename result<const result_of_member_function_template(T)>::type operator()(T) const;
- template<typename This, typename That> struct result<volatile This(That)> { typedef volatile That type; };
+ template<typename This, typename That> struct result<volatile This(That)> { typedef cv_overload_check<volatile That> type; };
template<class T> typename result<volatile result_of_member_function_template(T)>::type operator()(T) volatile;
- template<typename This, typename That> struct result<const volatile This(That)> { typedef const volatile That type; };
+ template<typename This, typename That> struct result<const volatile This(That)> { typedef cv_overload_check<const volatile That> type; };
template<class T> typename result<const volatile result_of_member_function_template(T)>::type operator()(T) const volatile;
template<typename This, typename That> struct result<This(That &, That)> { typedef That & type; };
@@ -91,14 +100,17 @@ struct result_of_member_function_template
template<class T> typename result<result_of_member_function_template(T const volatile &, T)>::type operator()(T const volatile &, T);
};
-struct no_result_type_or_result_of
+struct no_result_type_or_result
{
- int operator()(double);
- short operator()(double) const;
- unsigned int operator()();
- unsigned short operator()() volatile;
- const unsigned short operator()() const volatile;
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+ short operator()(double);
+ cv_overload_check<const short> operator()(double) const;
+ cv_overload_check<volatile short> operator()(double) volatile;
+ cv_overload_check<const volatile short> operator()(double) const volatile;
+ int operator()();
+ cv_overload_check<const int> operator()() const;
+ cv_overload_check<volatile int> operator()() volatile;
+ cv_overload_check<const volatile int> operator()() const volatile;
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
short operator()(int&&);
int operator()(int&);
long operator()(int const&);
@@ -106,20 +118,44 @@ struct no_result_type_or_result_of
};
template<typename T>
-struct no_result_type_or_result_of_template
+struct no_result_type_or_result_template
{
- int operator()(double);
- short operator()(double) const;
- unsigned int operator()();
- unsigned short operator()() volatile;
- const unsigned short operator()() const volatile;
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+ short operator()(double);
+ cv_overload_check<const short> operator()(double) const;
+ cv_overload_check<volatile short> operator()(double) volatile;
+ cv_overload_check<const volatile short> operator()(double) const volatile;
+ int operator()();
+ cv_overload_check<const int> operator()() const;
+ cv_overload_check<volatile int> operator()() volatile;
+ cv_overload_check<const volatile int> operator()() const volatile;
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
short operator()(int&&);
int operator()(int&);
long operator()(int const&);
#endif
};
+// sfinae_tests are derived from example code from Joel de Guzman,
+// which demonstrated the interaction between result_of and SFINAE.
+template <typename F, typename Arg>
+typename boost::result_of<F(Arg const&)>::type
+sfinae_test(F f, Arg const& arg)
+{
+ return f(arg);
+}
+
+template <typename F, typename Arg>
+typename boost::result_of<F(Arg&)>::type
+sfinae_test(F f, Arg& arg)
+{
+ return f(arg);
+}
+
+int sfinae_test_f(int& i)
+{
+ return i;
+}
+
struct X {};
int main()
@@ -130,6 +166,10 @@ int main()
typedef int (&func_ref)(float, double);
typedef int (*func_ptr_0)();
typedef int (&func_ref_0)();
+ typedef void (*func_ptr_void)(float, double);
+ typedef void (&func_ref_void)(float, double);
+ typedef void (*func_ptr_void_0)();
+ typedef void (&func_ref_void_0)();
typedef int (X::*mem_func_ptr)(float);
typedef int (X::*mem_func_ptr_c)(float) const;
typedef int (X::*mem_func_ptr_v)(float) volatile;
@@ -156,8 +196,8 @@ int main()
BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
// Prior to decltype, result_of could not deduce the return type
- // nullary function objects unless they exposed a result_type.
-#if !defined(BOOST_NO_DECLTYPE)
+ // of nullary function objects unless they exposed a result_type.
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE)
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, int>::value));
@@ -169,14 +209,11 @@ int main()
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
#endif
- BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
-
// Prior to decltype, result_of ignored a nested result<> if
// result_type was defined. After decltype, result_of deduces the
// actual return type of the function object, ignoring both
// result<> and result_type.
-#if !defined(BOOST_NO_DECLTYPE)
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE)
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, char>::value));
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, char>::value));
#else
@@ -184,41 +221,52 @@ int main()
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
#endif
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
+
BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(char, float)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<func_ref(char, float)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_0()>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<func_ref_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ref_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_void_0()>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ref_void_0()>::type, void>::value));
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_c(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_v(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(void)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(char, float)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref(char, float)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_0()>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_void_0()>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_void_0()>::type, void>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_c(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_v(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_0(X)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref(void)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(double)>::type, double>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const result_of_member_function_template(double)>::type, const double>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const volatile result_of_member_function_template(double)>::type, const volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const result_of_member_function_template(double)>::type, cv_overload_check<const double> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile result_of_member_function_template(double)>::type, cv_overload_check<volatile double> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile result_of_member_function_template(double)>::type, cv_overload_check<const volatile double> >::value));
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int &, int)>::type, int &>::value));
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const &, int)>::type, int const &>::value));
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(double)>::type, double>::value));
- BOOST_STATIC_ASSERT((is_same<tr1_result_of<const result_of_member_function_template(double)>::type, const double>::value));
- BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
- BOOST_STATIC_ASSERT((is_same<tr1_result_of<const volatile result_of_member_function_template(double)>::type, const volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const result_of_member_function_template(double)>::type, cv_overload_check<const double> >::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile result_of_member_function_template(double)>::type, cv_overload_check<volatile double> >::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const volatile result_of_member_function_template(double)>::type, cv_overload_check<const volatile double> >::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int &, int)>::type, int &>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int const &, int)>::type, int const &>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
@@ -231,26 +279,38 @@ int main()
BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t(int)>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t const(int)>::type,int>::value));
-#if !defined(BOOST_NO_DECLTYPE)
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(void)>::type, unsigned int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of(double)>::type, short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_of(void)>::type, unsigned short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_of(void)>::type, const unsigned short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(void)>::type, unsigned int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of_template<void>(double)>::type, short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_of_template<void>(void)>::type, unsigned short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_of_template<void>(void)>::type, const unsigned short>::value));
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(int&&)>::type, short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(int&)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(int const&)>::type, long>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(int&&)>::type, short>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(int&)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(int const&)>::type, long>::value));
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result(double)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result(double)>::type, cv_overload_check<const short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result(double)>::type, cv_overload_check<volatile short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result(double)>::type, cv_overload_check<const volatile short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result(void)>::type, cv_overload_check<const int> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result(void)>::type, cv_overload_check<volatile int> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result(void)>::type, cv_overload_check<const volatile int> >::value));
+
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_template<void>(double)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_template<void>(double)>::type, cv_overload_check<const short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_template<void>(double)>::type, cv_overload_check<volatile short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_template<void>(double)>::type, cv_overload_check<const volatile short> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_template<void>(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_template<void>(void)>::type, cv_overload_check<const int> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_template<void>(void)>::type, cv_overload_check<volatile int> >::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_template<void>(void)>::type, cv_overload_check<const volatile int> >::value));
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result(int&&)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result(int&)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result(int const&)>::type, long>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_template<void>(int&&)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_template<void>(int&)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_template<void>(int const&)>::type, long>::value));
#endif
#endif
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
+ int i = 123;
+ sfinae_test(sfinae_test_f, i);
+#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
+
return 0;
}
diff --git a/libs/utility/test/string_ref_test1.cpp b/libs/utility/test/string_ref_test1.cpp
new file mode 100644
index 0000000000..f1d4df2f47
--- /dev/null
+++ b/libs/utility/test/string_ref_test1.cpp
@@ -0,0 +1,109 @@
+/*
+ Copyright (c) Marshall Clow 2012-2012.
+
+ 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 <iostream>
+#include <algorithm>
+#include <string>
+
+#include <boost/utility/string_ref.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+typedef boost::string_ref string_ref;
+
+// Should be equal
+void interop ( const std::string &str, string_ref ref ) {
+// BOOST_CHECK ( str == ref );
+ BOOST_CHECK ( str.size () == ref.size ());
+ BOOST_CHECK ( std::equal ( str.begin (), str.end (), ref.begin ()));
+ BOOST_CHECK ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
+ }
+
+void null_tests ( const char *p ) {
+// All zero-length string-refs should be equal
+ string_ref sr1; // NULL, 0
+ string_ref sr2 ( NULL, 0 );
+ string_ref sr3 ( p, 0 );
+ string_ref sr4 ( p );
+ sr4.clear ();
+
+ BOOST_CHECK ( sr1 == sr2 );
+ BOOST_CHECK ( sr1 == sr3 );
+ BOOST_CHECK ( sr2 == sr3 );
+ BOOST_CHECK ( sr1 == sr4 );
+ }
+
+// make sure that substrings work just like strings
+void test_substr ( const std::string &str ) {
+ const size_t sz = str.size ();
+ string_ref ref ( str );
+
+// Substrings at the end
+ for ( size_t i = 0; i <= sz; ++ i )
+ interop ( str.substr ( i ), ref.substr ( i ));
+
+// Substrings at the beginning
+ for ( size_t i = 0; i <= sz; ++ i )
+ interop ( str.substr ( 0, i ), ref.substr ( 0, i ));
+
+// All possible substrings
+ for ( size_t i = 0; i < sz; ++i )
+ for ( size_t j = i; j < sz; ++j )
+ interop ( str.substr ( i, j ), ref.substr ( i, j ));
+ }
+
+// make sure that removing prefixes and suffixes work just like strings
+void test_remove ( const std::string &str ) {
+ const size_t sz = str.size ();
+ std::string work;
+ string_ref ref;
+
+ for ( size_t i = 1; i <= sz; ++i ) {
+ work = str;
+ ref = str;
+ while ( ref.size () >= i ) {
+ interop ( work, ref );
+ work.erase ( 0, i );
+ ref.remove_prefix (i);
+ }
+ }
+
+ for ( size_t i = 1; i < sz; ++ i ) {
+ work = str;
+ ref = str;
+ while ( ref.size () >= i ) {
+ interop ( work, ref );
+ work.erase ( work.size () - i, i );
+ ref.remove_suffix (i);
+ }
+ }
+ }
+
+const char *test_strings [] = {
+ "",
+ "1",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ "0123456789",
+ NULL
+ };
+
+BOOST_AUTO_TEST_CASE( test_main )
+{
+ const char **p = &test_strings[0];
+
+ while ( *p != NULL ) {
+ interop ( *p, *p );
+ test_substr ( *p );
+ test_remove ( *p );
+ null_tests ( *p );
+
+ p++;
+ }
+}
diff --git a/libs/utility/test/string_ref_test2.cpp b/libs/utility/test/string_ref_test2.cpp
new file mode 100644
index 0000000000..174405d02f
--- /dev/null
+++ b/libs/utility/test/string_ref_test2.cpp
@@ -0,0 +1,318 @@
+/*
+ Copyright (c) Marshall Clow 2012-2012.
+
+ 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 <iostream>
+#include <cstring> // for std::strchr
+
+#include <boost/utility/string_ref.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+typedef boost::string_ref string_ref;
+
+void ends_with ( const char *arg ) {
+ const size_t sz = strlen ( arg );
+ string_ref sr ( arg );
+ string_ref sr2 ( arg );
+ const char *p = arg;
+
+ while ( *p ) {
+ BOOST_CHECK ( sr.ends_with ( p ));
+ ++p;
+ }
+
+ while ( !sr2.empty ()) {
+ BOOST_CHECK ( sr.ends_with ( sr2 ));
+ sr2.remove_prefix (1);
+ }
+
+ sr2 = arg;
+ while ( !sr2.empty ()) {
+ BOOST_CHECK ( sr.ends_with ( sr2 ));
+ sr2.remove_prefix (1);
+ }
+
+ char ch = sz == 0 ? '\0' : arg [ sz - 1 ];
+ sr2 = arg;
+ if ( sz > 0 )
+ BOOST_CHECK ( sr2.ends_with ( ch ));
+ BOOST_CHECK ( !sr2.ends_with ( ++ch ));
+ BOOST_CHECK ( sr2.ends_with ( string_ref ()));
+ }
+
+void starts_with ( const char *arg ) {
+ const size_t sz = strlen ( arg );
+ string_ref sr ( arg );
+ string_ref sr2 ( arg );
+ const char *p = arg + std::strlen ( arg ) - 1;
+ while ( p >= arg ) {
+ std::string foo ( arg, p + 1 );
+ BOOST_CHECK ( sr.starts_with ( foo ));
+ --p;
+ }
+
+ while ( !sr2.empty ()) {
+ BOOST_CHECK ( sr.starts_with ( sr2 ));
+ sr2.remove_suffix (1);
+ }
+
+ char ch = *arg;
+ sr2 = arg;
+ if ( sz > 0 )
+ BOOST_CHECK ( sr2.starts_with ( ch ));
+ BOOST_CHECK ( !sr2.starts_with ( ++ch ));
+ BOOST_CHECK ( sr2.starts_with ( string_ref ()));
+ }
+
+void reverse ( const char *arg ) {
+// Round trip
+ string_ref sr1 ( arg );
+ std::string string1 ( sr1.rbegin (), sr1.rend ());
+ string_ref sr2 ( string1 );
+ std::string string2 ( sr2.rbegin (), sr2.rend ());
+
+ BOOST_CHECK ( std::equal ( sr2.rbegin (), sr2.rend (), arg ));
+ BOOST_CHECK ( string2 == arg );
+ BOOST_CHECK ( std::equal ( sr1.begin (), sr1.end (), string2.begin ()));
+ }
+
+// This helper function eliminates signed vs. unsigned warnings
+string_ref::size_type ptr_diff ( const char *res, const char *base ) {
+ BOOST_CHECK ( res >= base );
+ return static_cast<string_ref::size_type> ( res - base );
+ }
+
+void find ( const char *arg ) {
+ string_ref sr1;
+ string_ref sr2;
+ const char *p;
+
+// Look for each character in the string(searching from the start)
+ p = arg;
+ sr1 = arg;
+ while ( *p ) {
+ string_ref::size_type pos = sr1.find(*p);
+ BOOST_CHECK ( pos != string_ref::npos && ( pos <= ptr_diff ( p, arg )));
+ ++p;
+ }
+
+// Look for each character in the string (searching from the end)
+ p = arg;
+ sr1 = arg;
+ while ( *p ) {
+ string_ref::size_type pos = sr1.rfind(*p);
+ BOOST_CHECK ( pos != string_ref::npos && pos < sr1.size () && ( pos >= ptr_diff ( p, arg )));
+ ++p;
+ }
+
+// Look for pairs on characters (searching from the start)
+ sr1 = arg;
+ p = arg;
+ while ( *p && *(p+1)) {
+ string_ref sr3 ( p, 2 );
+ string_ref::size_type pos = sr1.find ( sr3 );
+ BOOST_CHECK ( pos != string_ref::npos && pos <= static_cast<string_ref::size_type>( p - arg ));
+ p++;
+ }
+
+ sr1 = arg;
+ p = arg;
+// for all possible chars, see if we find them in the right place.
+// Note that strchr will/might do the _wrong_ thing if we search for NULL
+ for ( int ch = 1; ch < 256; ++ch ) {
+ string_ref::size_type pos = sr1.find(ch);
+ const char *strp = std::strchr ( arg, ch );
+ BOOST_CHECK (( strp == NULL ) == ( pos == string_ref::npos ));
+ if ( strp != NULL )
+ BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
+ }
+
+ sr1 = arg;
+ p = arg;
+// for all possible chars, see if we find them in the right place.
+// Note that strchr will/might do the _wrong_ thing if we search for NULL
+ for ( int ch = 1; ch < 256; ++ch ) {
+ string_ref::size_type pos = sr1.rfind(ch);
+ const char *strp = std::strrchr ( arg, ch );
+ BOOST_CHECK (( strp == NULL ) == ( pos == string_ref::npos ));
+ if ( strp != NULL )
+ BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
+ }
+
+
+// Find everything at the start
+ p = arg;
+ sr1 = arg;
+ while ( !sr1.empty ()) {
+ string_ref::size_type pos = sr1.find(*p);
+ BOOST_CHECK ( pos == 0 );
+ sr1.remove_prefix (1);
+ ++p;
+ }
+
+// Find everything at the end
+ sr1 = arg;
+ p = arg + strlen ( arg ) - 1;
+ while ( !sr1.empty ()) {
+ string_ref::size_type pos = sr1.rfind(*p);
+ BOOST_CHECK ( pos == sr1.size () - 1 );
+ sr1.remove_suffix (1);
+ --p;
+ }
+
+// Find everything at the start
+ sr1 = arg;
+ p = arg;
+ while ( !sr1.empty ()) {
+ string_ref::size_type pos = sr1.find_first_of(*p);
+ BOOST_CHECK ( pos == 0 );
+ sr1.remove_prefix (1);
+ ++p;
+ }
+
+
+// Find everything at the end
+ sr1 = arg;
+ p = arg + strlen ( arg ) - 1;
+ while ( !sr1.empty ()) {
+ string_ref::size_type pos = sr1.find_last_of(*p);
+ BOOST_CHECK ( pos == sr1.size () - 1 );
+ sr1.remove_suffix (1);
+ --p;
+ }
+
+// Basic sanity checking for "find_first_of / find_first_not_of"
+ sr1 = arg;
+ sr2 = arg;
+ while ( !sr1.empty() ) {
+ BOOST_CHECK ( sr1.find_first_of ( sr2 ) == 0 );
+ BOOST_CHECK ( sr1.find_first_not_of ( sr2 ) == string_ref::npos );
+ sr1.remove_prefix ( 1 );
+ }
+
+ p = arg;
+ sr1 = arg;
+ while ( *p ) {
+ string_ref::size_type pos1 = sr1.find_first_of(*p);
+ string_ref::size_type pos2 = sr1.find_first_not_of(*p);
+ BOOST_CHECK ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
+ if ( pos2 != string_ref::npos ) {
+ for ( size_t i = 0 ; i < pos2; ++i )
+ BOOST_CHECK ( sr1[i] == *p );
+ BOOST_CHECK ( sr1 [ pos2 ] != *p );
+ }
+
+ BOOST_CHECK ( pos2 != pos1 );
+ ++p;
+ }
+
+// Basic sanity checking for "find_last_of / find_last_not_of"
+ sr1 = arg;
+ sr2 = arg;
+ while ( !sr1.empty() ) {
+ BOOST_CHECK ( sr1.find_last_of ( sr2 ) == ( sr1.size () - 1 ));
+ BOOST_CHECK ( sr1.find_last_not_of ( sr2 ) == string_ref::npos );
+ sr1.remove_suffix ( 1 );
+ }
+
+ p = arg;
+ sr1 = arg;
+ while ( *p ) {
+ string_ref::size_type pos1 = sr1.find_last_of(*p);
+ string_ref::size_type pos2 = sr1.find_last_not_of(*p);
+ BOOST_CHECK ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
+ BOOST_CHECK ( pos2 == string_ref::npos || pos1 < sr1.size ());
+ if ( pos2 != string_ref::npos ) {
+ for ( size_t i = sr1.size () -1 ; i > pos2; --i )
+ BOOST_CHECK ( sr1[i] == *p );
+ BOOST_CHECK ( sr1 [ pos2 ] != *p );
+ }
+
+ BOOST_CHECK ( pos2 != pos1 );
+ ++p;
+ }
+
+ }
+
+
+void to_string ( const char *arg ) {
+ string_ref sr1;
+ std::string str1;
+ std::string str2;
+
+ str1.assign ( arg );
+ sr1 = arg;
+// str2 = sr1.to_string<std::allocator<char> > ();
+ str2 = sr1.to_string ();
+ BOOST_CHECK ( str1 == str2 );
+
+#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+ std::string str3 = static_cast<std::string> ( sr1 );
+ BOOST_CHECK ( str1 == str3 );
+#endif
+ }
+
+void compare ( const char *arg ) {
+ string_ref sr1;
+ std::string str1;
+ std::string str2 = str1;
+
+ str1.assign ( arg );
+ sr1 = arg;
+ BOOST_CHECK ( sr1 == sr1); // compare string_ref and string_ref
+ BOOST_CHECK ( sr1 == str1); // compare string and string_ref
+ BOOST_CHECK ( str1 == sr1 ); // compare string_ref and string
+ BOOST_CHECK ( sr1 == arg ); // compare string_ref and pointer
+ BOOST_CHECK ( arg == sr1 ); // compare pointer and string_ref
+
+ if ( sr1.size () > 0 ) {
+ (*str1.rbegin())++;
+ BOOST_CHECK ( sr1 != str1 );
+ BOOST_CHECK ( str1 != sr1 );
+ BOOST_CHECK ( sr1 < str1 );
+ BOOST_CHECK ( sr1 <= str1 );
+ BOOST_CHECK ( str1 > sr1 );
+ BOOST_CHECK ( str1 >= sr1 );
+
+ (*str1.rbegin()) -= 2;
+ BOOST_CHECK ( sr1 != str1 );
+ BOOST_CHECK ( str1 != sr1 );
+ BOOST_CHECK ( sr1 > str1 );
+ BOOST_CHECK ( sr1 >= str1 );
+ BOOST_CHECK ( str1 < sr1 );
+ BOOST_CHECK ( str1 <= sr1 );
+ }
+ }
+
+const char *test_strings [] = {
+ "",
+ "0",
+ "abc",
+ "AAA", // all the same
+ "adsfadadiaef;alkdg;aljt;j agl;sjrl;tjs;lga;lretj;srg[w349u5209dsfadfasdfasdfadsf",
+ "abc\0asdfadsfasf",
+ NULL
+ };
+
+BOOST_AUTO_TEST_CASE( test_main )
+{
+ const char **p = &test_strings[0];
+
+ while ( *p != NULL ) {
+ starts_with ( *p );
+ ends_with ( *p );
+ reverse ( *p );
+ find ( *p );
+ to_string ( *p );
+ compare ( *p );
+
+ p++;
+ }
+}
diff --git a/libs/utility/test/string_ref_test_io.cpp b/libs/utility/test/string_ref_test_io.cpp
new file mode 100644
index 0000000000..376f695a4e
--- /dev/null
+++ b/libs/utility/test/string_ref_test_io.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright Andrey Semashev 2013.
+ * 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)
+ */
+/*!
+ * \file string_ref_test_io.cpp
+ * \author Andrey Semashev
+ * \date 26.05.2013
+ *
+ * \brief This header contains tests for stream operations of \c basic_string_ref.
+ */
+
+#define BOOST_TEST_MODULE string_ref_test_io
+
+#include <boost/utility/string_ref.hpp>
+
+#include <iomanip>
+#include <sstream>
+#include <algorithm>
+#include <iterator>
+#include <string>
+
+#include <boost/config.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/test/unit_test.hpp>
+
+typedef boost::mpl::vector<
+ char
+#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ , wchar_t
+#endif
+/* Current implementations seem to be missing codecvt facets to convert chars to char16_t and char32_t even though the types are available.
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+ , char16_t
+#endif
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+ , char32_t
+#endif
+*/
+>::type char_types;
+
+static const char* test_strings[] =
+{
+ "begin",
+ "abcd",
+ "end"
+};
+
+//! The context with test data for particular character type
+template< typename CharT >
+struct context
+{
+ typedef CharT char_type;
+ typedef std::basic_string< char_type > string_type;
+ typedef std::basic_ostringstream< char_type > ostream_type;
+
+ string_type begin, abcd, end;
+
+ context()
+ {
+ boost::string_ref str = test_strings[0];
+ std::copy(str.begin(), str.end(), std::back_inserter(begin));
+
+ str = test_strings[1];
+ std::copy(str.begin(), str.end(), std::back_inserter(abcd));
+
+ str = test_strings[2];
+ std::copy(str.begin(), str.end(), std::back_inserter(end));
+ }
+};
+
+// Test regular output
+BOOST_AUTO_TEST_CASE_TEMPLATE(string_ref_output, CharT, char_types)
+{
+ typedef CharT char_type;
+ typedef std::basic_string< char_type > string_type;
+ typedef std::basic_ostringstream< char_type > ostream_type;
+ typedef boost::basic_string_ref< char_type > string_ref_type;
+
+ context< char_type > ctx;
+
+ ostream_type strm;
+ strm << string_ref_type(ctx.abcd);
+ BOOST_CHECK(strm.str() == ctx.abcd);
+}
+
+// Test support for padding
+BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
+{
+ typedef CharT char_type;
+ typedef std::basic_string< char_type > string_type;
+ typedef std::basic_ostringstream< char_type > ostream_type;
+ typedef boost::basic_string_ref< char_type > string_ref_type;
+
+ context< char_type > ctx;
+
+ // Test for padding
+ {
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::setw(8) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::setw(8) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+ }
+
+ // Test for long padding
+ {
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::setw(100) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::setw(100) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+ }
+
+ // Test that short width does not truncate the string
+ {
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::setw(1) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::setw(1) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+ }
+}
+
+// Test support for padding fill
+BOOST_AUTO_TEST_CASE_TEMPLATE(padding_fill, CharT, char_types)
+{
+ typedef CharT char_type;
+ typedef std::basic_string< char_type > string_type;
+ typedef std::basic_ostringstream< char_type > ostream_type;
+ typedef boost::basic_string_ref< char_type > string_ref_type;
+
+ context< char_type > ctx;
+
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::setfill(static_cast< char_type >('x')) << std::setw(8) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::setfill(static_cast< char_type >('x')) << std::setw(8) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+}
+
+// Test support for alignment
+BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
+{
+ typedef CharT char_type;
+ typedef std::basic_string< char_type > string_type;
+ typedef std::basic_ostringstream< char_type > ostream_type;
+ typedef boost::basic_string_ref< char_type > string_ref_type;
+
+ context< char_type > ctx;
+
+ // Left alignment
+ {
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::left << std::setw(8) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::left << std::setw(8) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+ }
+
+ // Right alignment
+ {
+ ostream_type strm_ref;
+ strm_ref << ctx.begin << std::right << std::setw(8) << string_ref_type(ctx.abcd) << ctx.end;
+
+ ostream_type strm_correct;
+ strm_correct << ctx.begin << std::right << std::setw(8) << ctx.abcd << ctx.end;
+
+ BOOST_CHECK(strm_ref.str() == strm_correct.str());
+ }
+}
diff --git a/libs/utility/utility.htm b/libs/utility/utility.htm
index e2cbfd7b2d..5443bd4890 100644
--- a/libs/utility/utility.htm
+++ b/libs/utility/utility.htm
@@ -11,27 +11,23 @@
<h2>Contents</h2>
<ul>
<li>
- Class templates supporting the <a href="base_from_member.html">base-from-member
- idiom</a></li>
+ Class templates supporting the <a href="doc/html/base_from_member.html">
+ base-from-member idiom</a></li>
<li>
- Function templates <a href="#checked_delete">checked_delete() and
- checked_array_delete()</a></li>
+ Function templates <a href="../core/doc/html/core/checked_delete.html">checked_delete() and
+ checked_array_delete()</a> (moved to the Boost.Core library)</li>
<li>
Function templates <a href="#functions_next_prior">next() and prior()</a></li>
<li>
- Class <a href="#Class_noncopyable">noncopyable</a></li>
+ Class <a href="../core/doc/html/core/noncopyable.html">noncopyable</a> (moved to the Boost.Core library)</li>
<li>
- Function template <a href="#addressof">addressof()</a></li>
+ Function template <a href="../core/doc/html/core/addressof.html">addressof()</a> (moved to the Boost.Core library)</li>
<li>Class template <a href="#result_of">result_of</a></li>
<li>
Macro <a href="#BOOST_BINARY">BOOST_BINARY</a></li>
<li><a href="index.html">Other utilities not part of <code>utility.hpp</code></a></li>
</ul>
<h2>
- Function templates <a name="checked_delete">checked_delete</a>() and
- checked_array_delete()</h2>
- <p>See <a href="checked_delete.html">separate documentation</a>.</p>
- <h2>
<a name="functions_next_prior">Function</a> templates next() and prior()</h2>
<p>Certain data types, such as the C++ Standard Library's forward and bidirectional
iterators, do not provide addition and subtraction via operator+() or
@@ -71,79 +67,11 @@ const std::list&lt;T&gt;::iterator next = boost::next(prev, 2);</pre>
example, the iterator four iterators prior to the given iterator <code>p</code>
may be obtained by <code>prior(p, 4)</code>.</p>
<p>Contributed by <a href="http://www.boost.org/people/dave_abrahams.htm">Dave Abrahams</a>. Two-argument versions by Daniel Walker.</p>
- <h2><a name="Class_noncopyable">Class noncopyable</a></h2>
- <p>Class <strong>noncopyable</strong> is a base class.&nbsp; Derive your own class
- from <strong>noncopyable</strong> when you want to prohibit copy construction
- and copy assignment.</p>
- <p>Some objects, particularly those which hold complex resources like files or
- network connections, have no sensible copy semantics.&nbsp; Sometimes there are
- possible copy semantics, but these would be of very limited usefulness and be
- very difficult to implement correctly.&nbsp; Sometimes you're implementing a
- class that doesn't need to be copied just yet and you don't want to take the
- time to write the appropriate functions.&nbsp; Deriving from <b>noncopyable</b>
- will prevent the otherwise implicitly-generated functions (which don't have the
- proper semantics) from becoming a trap for other programmers.</p>
- <p>The traditional way to deal with these is to declare a private copy constructor
- and copy assignment, and then document why this is done.&nbsp; But deriving
- from <b>noncopyable</b> is simpler and clearer, and doesn't require additional
- documentation.</p>
- <p>The program <a href="noncopyable_test.cpp">noncopyable_test.cpp</a> can be used
- to verify class <b>noncopyable</b> works as expected. It has have been run
- successfully under GCC 2.95, Metrowerks CodeWarrior 5.0, and Microsoft Visual
- C++ 6.0 sp 3.</p>
- <p>Contributed by <a href="http://www.boost.org/people/dave_abrahams.htm">Dave Abrahams</a>.</p>
- <h3>Example</h3>
- <blockquote>
- <pre>// inside one of your own headers ...
-#include &lt;boost/utility.hpp&gt;
-class ResourceLadenFileSystem : boost::noncopyable {
-...</pre>
- </blockquote>
- <h3>Rationale</h3>
- <p>Class noncopyable has protected constructor and destructor members to emphasize
- that it is to be used only as a base class.&nbsp; Dave Abrahams notes concern
- about the effect on compiler optimization of adding (even trivial inline)
- destructor declarations. He says &quot;Probably this concern is misplaced,
- because noncopyable will be used mostly for classes which own resources and
- thus have non-trivial destruction semantics.&quot;</p>
- <h2><a name="addressof">Function template addressof()</a></h2>
- <p>Function <strong>addressof()</strong> returns the address of an object.</p>
- <blockquote>
- <pre>template &lt;typename T&gt; inline T* addressof(T& v);
-template &lt;typename T&gt; inline const T* addressof(const T& v);
-template &lt;typename T&gt; inline volatile T* addressof(volatile T& v);
-template &lt;typename T&gt; inline const volatile T* addressof(const volatile T& v);
-</pre>
- </blockquote>
- <p>C++ allows programmers to replace the unary <strong>operator&()</strong> class
- member used to get the address of an object. Getting the real address of an
- object requires ugly casting tricks to avoid invoking the overloaded <strong>operator&()</strong>.
- Function <strong>addressof()</strong> provides a wrapper around the necessary
- code to make it easy to get an object's real address.
- </p>
- <p>The program <a href="addressof_test.cpp">addressof_test.cpp</a> can be used to
- verify that <b>addressof()</b> works as expected.</p>
- <p>Contributed by Brad King based on ideas from discussion with Doug Gregor.</p>
- <h3>Example</h3>
- <blockquote>
- <pre>#include &lt;boost/utility.hpp&gt;
-
-struct useless_type {};
-class nonaddressable {
- useless_type operator&() const;
-};
-
-void f() {
- nonaddressable x;
- nonaddressable* xp = boost::addressof(x);
- // nonaddressable* xpe = &amp;x; /* error */
-}</pre>
- </blockquote>
<h2><a name="result_of">Class template
result_of</a></h2> <p>The class template
<code>result_of</code> helps determine the type of a
- call expression. Given an lvalue <code>f</code> of
+ call expression. For example, given an lvalue <code>f</code> of
type <code>F</code> and lvalues <code>t1</code>,
<code>t2</code>, ..., <code>t<em>N</em></code> of
types <code>T1</code>, <code>T2</code>, ...,
@@ -155,22 +83,24 @@ void f() {
the type <code>F</code> to be a function pointer,
function reference, member function pointer, or class
type. By default, <em>N</em> may be any value between 0 and
- 10. To change the upper limit, define the macro
+ 16. To change the upper limit, define the macro
<code>BOOST_RESULT_OF_NUM_ARGS</code> to the maximum
value for <em>N</em>. Class template <code>result_of</code>
resides in the header <code>&lt;<a
href="../../boost/utility/result_of.hpp">boost/utility/result_of.hpp</a>&gt;</code>.</p>
- <p>If your compiler supports <code>decltype</code>,
- then you can enable automatic result type deduction by
- defining the macro <code>BOOST_RESULT_OF_USE_DECLTYPE</code>,
- as in the following example.</p>
+ <p>If your compiler's support for <code>decltype</code> is
+ adequate, <code>result_of</code> automatically uses it to
+ deduce the type of the call expression, in which case
+ <code>result_of&lt;F(T1, T2, ...,
+ T<em>N</em>)&gt;::type</code> names the type
+ <code>decltype(boost::declval&lt;F&gt;()(boost::declval&lt;T1&gt;(),
+ boost::declval&lt;T2&gt;(), ...,
+ boost::declval&lt;T<em>N</em>&gt;()))</code>, as in the
+ following example.</p>
<blockquote>
- <pre>#define BOOST_RESULT_OF_USE_DECLTYPE
-#include &lt;boost/utility/result_of.hpp&gt;
-
-struct functor {
+ <pre>struct functor {
template&lt;class T&gt;
T operator()(T x)
{
@@ -180,21 +110,29 @@ struct functor {
typedef boost::result_of&lt;
functor(int)
-&gt;::type type;</pre>
+&gt;::type type; // type is int</pre>
</blockquote>
- <p>If <code>decltype</code> is not enabled,
+ <p>You can test whether <code>result_of</code> is using
+ <code>decltype</code> by checking if the macro
+ <code>BOOST_RESULT_OF_USE_DECLTYPE</code> is defined after
+ including <code>result_of.hpp</code>. You can also force
+ <code>result_of</code> to use <code>decltype</code> by
+ defining <code>BOOST_RESULT_OF_USE_DECLTYPE</code> prior
+ to including <code>result_of.hpp</code>.</p>
+
+ <p>If <code>decltype</code> is not used,
then automatic result type deduction of function
objects is not possible. Instead, <code>result_of</code>
uses the following protocol to allow the programmer to
specify a type. When <code>F</code> is a class type with a
member type <code>result_type</code>,
<code>result_of&lt;F(T1, T2, ...,
- T<em>N</em>)&gt;</code> is
+ T<em>N</em>)&gt;::type</code> is
<code>F::result_type</code>. When <code>F</code> does
not contain <code>result_type</code>,
<code>result_of&lt;F(T1, T2, ...,
- T<em>N</em>)&gt;</code> is <code>F::result&lt;F(T1,
+ T<em>N</em>)&gt;::type</code> is <code>F::result&lt;F(T1,
T2, ..., T<em>N</em>)&gt;::type</code> when
<code><em>N</em> &gt; 0</code> or <code>void</code>
when <code><em>N</em> = 0</code>. Note that it is the
@@ -221,22 +159,69 @@ typedef boost::result_of&lt;
typedef boost::result_of&lt;
functor(int)
-&gt;::type type;</pre>
+&gt;::type type; // type is int</pre>
</blockquote>
- <p>In a future
- release, <code>BOOST_RESULT_OF_USE_DECLTYPE</code>
- may be enabled by default on compilers that
- support <code>decltype</code>, so if you use the above
- protocol please take care to ensure that
- the <code>result_type</code>
- and <code>result&lt;&gt;</code> members accurately
- represent the result type. If you wish to continue to
+ <p>Since <code>decltype</code> is a new language
+ feature recently standardized in C++11,
+ if you are writing a function object
+ to be used with <code>result_of</code>, for
+ maximum portability, you might consider following
+ the above protocol even if your compiler has
+ proper <code>decltype</code> support. If you wish to continue to
use the protocol on compilers that
- support <code>decltype</code>,
- use <code>boost::tr1_result_of</code>, which is also
- defined
- in <code>&lt;<a href="../../boost/utility/result_of.hpp">boost/utility/result_of.hpp</a>&gt;</code>.</p>
+ support <code>decltype</code>, there are two options:
+ You can use <code>boost::tr1_result_of</code>, which is also
+ defined in <code>&lt;<a href="../../boost/utility/result_of.hpp">boost/utility/result_of.hpp</a>&gt;</code>.
+ Alternatively, you can define the macro
+ <code>BOOST_RESULT_OF_USE_TR1</code>, which causes
+ <code>result_of</code> to use the protocol described
+ above instead of <code>decltype</code>. If you choose to
+ follow the protocol, take care to ensure that the
+ <code>result_type</code> and
+ <code>result&lt;&gt;</code> members accurately
+ represent the return type of
+ <code>operator()</code> given a call expression.</p>
+
+ <p>Additionally, <code>boost::result_of</code>
+ provides a third mode of operation, which some users
+ may find convenient. When
+ <code>BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK</code>
+ is defined, <code>boost::result_of</code> behaves as
+ follows. If the function object has a member
+ type <code>result_type</code> or member
+ template <code>result&lt;&gt;</code>, then
+ <code>boost::result_of</code> will use the TR1
+ protocol. Otherwise,
+ <code>boost::result_of</code> will
+ use <code>decltype</code>. Using TR1 with
+ a <code>declytpe</code> fallback may workaround
+ certain problems at the cost of portability. For
+ example:
+ <ul>
+ <li>Deficient compiler: If your code
+ requires <code>boost::result_of</code> to work
+ with incomplete return types but your
+ compiler's <code>decltype</code> implementation
+ does not support incomplete return types, then you
+ can use the TR1 protocol as a workaround. Support
+ for incomplete return types was added late in the
+ C++11 standardization process
+ (see <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf">N3276</a>)
+ and is not implemented by some compilers.</li>
+
+ <li>Deficient legacy code: If your existing TR1
+ function object advertises a different type than
+ the actual result type deduced
+ by <code>decltype</code>, then using TR1 with a
+ <code>decltype</code> fallback will allow you to
+ work with both your existing TR1 function objects
+ and new C++11 function object. This situation
+ could occur if your legacy function objects
+ misused the TR1 protocol. See the documentation on
+ known <a href="#result_of_tr1_diff">differences</a>
+ between <code>boost::result_of</code> and TR1.</li>
+ </ul>
<a name="BOOST_NO_RESULT_OF"></a>
<p>This implementation of <code>result_of</code>
@@ -252,11 +237,324 @@ typedef boost::result_of&lt;
Technical Report,
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">N1836</a>,
or, for motivation and design rationale,
- the <code>result_of</code> <a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html">proposal</a>.</p>
- Contributed by Doug Gregor.</p>
+ the <code>result_of</code> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1454.html">proposal</a>.</p>
+
+ <a name="result_of_guidelines">
+ <h3>Usage guidelines for boost::result_of</h3>
+ </a>
+
+ <p>The following are general suggestions about when
+ and how to use <code>boost::result_of</code>.</p>
+
+ <ol>
+ <li> If you are targeting C++11 and are not concerned
+ about portability to non-compliant compilers or
+ previous versions of the standard, then use
+ <code>std::result_of</code>. If <code>std::result_of</code>
+ meets your needs, then there's no reason to stop using
+ it.</li>
+
+ <li> If you are targeting C++11 but may port your code
+ to legacy compilers at some time in the future, then
+ use <code>boost::result_of</code> with
+ <code>decltype</code>. When <code>decltype</code> is
+ used <code>boost::result_of</code>
+ and <code>std::result_of</code> are usually
+ interchangeable. See the documentation on
+ known <a href="#result_of_cxx11_diff">differences</a>
+ between boost::result_of and C++11 result_of.</li>
+
+ <li> If compiler portability is required,
+ use <code>boost::result_of</code> with the TR1 protocol.</li>
+ </ol>
+
+ <p>Regardless of how you
+ configure <code>boost::result_of</code>, it is
+ important to bear in mind that the return type of a
+ function may change depending on its arguments, and
+ additionally, the return type of a member function may
+ change depending on the cv-qualification of the
+ object. <code>boost::result_of</code> must be passed
+ the appropriately cv-qualified types in order to
+ deduce the corresponding return type. For example:
+
+ <blockquote>
+ <pre>struct functor {
+ int& operator()(int);
+ int const& operator()(int) const;
+
+ float& operator()(float&);
+ float const& operator()(float const&);
+};
+
+typedef boost::result_of&lt;
+ functor(int)
+&gt;::type type1; // type1 is int &
+
+typedef boost::result_of&lt;
+ const functor(int)
+&gt;::type type2; // type2 is int const &
+
+typedef boost::result_of&lt;
+ functor(float&)
+&gt;::type type3; // type3 is float &
+
+typedef boost::result_of&lt;
+ functor(float const&)
+&gt;::type type4; // type4 is float const &</pre>
+ </blockquote>
+
+ <a name="result_of_tr1_protocol_guidelines">
+ <h3>Usage guidelines for the TR1 result_of protocol</h3>
+ </a>
+
+ <p>On compliant C++11
+ compilers, <code>boost::result_of</code> can
+ use <code>decltype</code> to deduce the type of any
+ call expression, including calls to function
+ objects. However, on pre-C++11 compilers or on
+ compilers without adequate decltype support,
+ additional scaffolding is needed from function
+ objects as described above. The following are
+ suggestions about how to use the TR1 protocol.</p>
+
+ <ul>
+ <li>When the return type does not depend on the
+ argument types or the cv-qualification of the
+ function object, simply
+ define <code>result_type</code>. There is no need
+ to use the <code>result</code> template unless the
+ return type varies.</li>
+
+ <li>Use the protocol specified type when defining
+ function prototypes. This can help ensure the
+ actual return type does not get out of sync with
+ the protocol specification. For example:
+
+ <blockquote>
+ <pre>struct functor {
+ typedef int result_type;
+ result_type operator()(int);
+};</pre>
+ </blockquote> </li>
+
+ <li>Always specify the <code>result</code>
+ specialization near the corresponding
+ <code>operator()</code> overload. This can make it
+ easier to keep the specializations in sync with the
+ overloads. For example:
+
+ <blockquote>
+ <pre>struct functor {
+ template&lt;class&gt; struct result;
+
+ template&lt;class F&gt;
+ struct result&lt;F(int)&gt; {
+ typedef int& type;
+ };
+ result&lt;functor(int)&gt;::type operator()(int);
+
+ template&lt;class F&gt;
+ struct result&lt;const F(int)&gt; {
+ typedef int const& type;
+ };
+ result&lt;const functor(int)&gt;::type operator()(int) const;
+};</pre>
+ </blockquote> </li>
+
+ <li>Use type transformations to simplify
+ the <code>result</code> template specialization. For
+ example, the following uses
+ <a href="../type_traits/doc/html/index.html">Boost.TypeTraits</a>
+ to specialize the <code>result</code> template for
+ a single <code>operator()</code> that can be called on
+ both a const and non-const function object with
+ either an lvalue or rvalue argument.
+
+ <blockquote>
+ <pre>struct functor {
+ template&lt;class&gt; struct result;
+
+ template&lt;class F, class T&gt;
+ struct result&lt;F(T)&gt;
+ : boost::remove_cv&lt;
+ typename boost::remove_reference&lt;T&gt;::type
+ &gt;
+ {};
+
+ template&lt;class T&gt;
+ T operator()(T const&amp; x) const;
+};</pre>
+ </blockquote></li>
+ </ul>
+
+ <a name="result_of_tr1_diff">
+ <h3>Known differences between boost::result_of and TR1 result_of</h3>
+ </a>
+
+ When using <code>decltype</code>, <code>boost::result_of</code>
+ ignores the TR1 protocol and instead deduces the
+ return type of function objects directly
+ via <code>decltype</code>. In most situations, users
+ will not notice a difference, so long as they use the
+ protocol correctly. The following are situations in
+ which the type deduced
+ by <code>boost::result_of</code> is known to differ depending on
+ whether <code>decltype</code> or the TR1 protocol is
+ used.
+
+ <ul>
+ <li> TR1 protocol misusage
+
+ <p>When using the TR1
+ protocol, <code>boost::result_of</code> cannot
+ detect whether the actual type of a call to a
+ function object is the same as the type specified
+ by the protocol, which allows for the possibility
+ of inadvertent mismatches between the specified
+ type and the actual type. When
+ using <code>decltype</code>, these subtle bugs
+ may result in compilation errors. For example:</p>
+
+ <blockquote>
+ <pre>struct functor {
+ typedef short result_type;
+ int operator()(short);
+};
+
+#ifdef BOOST_RESULT_OF_USE_DECLTYPE
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;boost::result_of&lt;functor(short)&gt;::type, int&gt;::value
+));
+
+#else
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;boost::result_of&lt;functor(short)&gt;::type, short&gt;::value
+));
+
+#endif</pre>
+ </blockquote>
+
+ <p>Note that the user can
+ force <code>boost::result_of</code> to use the TR1
+ protocol even on platforms that
+ support <code>decltype</code> by
+ defining <code>BOOST_RESULT_OF_USE_TR1</code>.</p></li>
+
+ <li> Nullary function objects
+
+ <p>When using the TR1 protocol, <code>boost::result_of</code>
+ cannot always deduce the type of calls to
+ nullary function objects, in which case the
+ type defaults to void. When using <code>decltype</code>,
+ <code>boost::result_of</code> always gives the actual type of the
+ call expression. For example:</p>
+
+ <blockquote>
+ <pre>struct functor {
+ template&lt;class&gt; struct result {
+ typedef int type;
+ };
+ int operator()();
+};
+
+#ifdef BOOST_RESULT_OF_USE_DECLTYPE
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;boost::result_of&lt;functor()&gt;::type, int&gt;::value
+));
+
+#else
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;boost::result_of&lt;functor()&gt;::type, void&gt;::value
+));
+
+#endif</pre>
+ </blockquote>
+
+ <p>Note that there are some workarounds for the
+ nullary function problem. So long as the return
+ type does not vary,
+ <code>result_type</code> can always be used to
+ specify the return type regardless of arity. If the
+ return type does vary, then the user can
+ specialize <code>boost::result_of</code> itself for
+ nullary calls.</p></li>
+
+ <li> Non-class prvalues and cv-qualification
+
+ <p>When using the TR1
+ protocol, <code>boost::result_of</code> will
+ report the cv-qualified type specified
+ by <code>result_type</code> or
+ the <code>result</code> template regardless of
+ the actual cv-qualification of the call
+ expression. When using
+ <code>decltype</code>, <code>boost::result_of</code>
+ will report the actual type of the call expression,
+ which is not cv-qualified when the expression is a
+ non-class prvalue. For example:</p>
+
+ <blockquote>
+ <pre>struct functor {
+ template&lt;class&gt; struct result;
+ template&lt;class F, class T&gt; struct result&lt;F(const T)&gt; {
+ typedef const T type;
+ };
+
+ const short operator()(const short);
+ int const & operator()(int const &);
+};
+
+// Non-prvalue call expressions work the same with or without decltype.
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;
+ boost::result_of&lt;functor(int const &)&gt;::type,
+ int const &
+::value
+));
+
+// Non-class prvalue call expressions are not actually cv-qualified,
+// but only the decltype-based result_of reports this accurately.
+
+#ifdef BOOST_RESULT_OF_USE_DECLTYPE
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;
+ boost::result_of&lt;functor(const short)&gt;::type,
+ short
+::value
+));
+
+#else
+
+BOOST_STATIC_ASSERT((
+ boost::is_same&lt;
+ boost::result_of&lt;functor(const short)&gt;::type,
+ const short
+::value
+));
+
+#endif</pre>
+ </blockquote></li>
+ </ul>
+
+ <a name="result_of_cxx11_diff">
+ <h3>Known differences between boost::result_of and C++11 result_of</h3>
+ </a>
+
+ <p>When using <code>decltype</code>, <code>boost::result_of</code>
+ implements most of the C++11 result_of
+ specification. One known exception is that
+ <code>boost::result_of</code> does not implement the
+ requirements regarding pointers to member data.</p>
+
+ <p>Created by Doug Gregor. Contributions from Daniel Walker, Eric Niebler, Michel Morin and others</p>
- <h2>Class templates for the Base-from-Member Idiom</h2>
- <p>See <a href="base_from_member.html">separate documentation</a>.</p>
<h2><a name="BOOST_BINARY">Macro BOOST_BINARY</a></h2>
<p>The macro <code>BOOST_BINARY</code> is used for the
diff --git a/libs/utility/value_init.htm b/libs/utility/value_init.htm
index 4ae9177604..3222f691ce 100644
--- a/libs/utility/value_init.htm
+++ b/libs/utility/value_init.htm
@@ -159,10 +159,10 @@ the object shall be value-initialized (but see below). However, if a <i>declara
<h3><a name="valueinit">value-initialization</a></h3>
<p>The first <a
- href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/cwg_defects.html">Technical
+ href="http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html">Technical
Corrigendum for the C++ Standard</a> (TC1), whose draft was released to
the public in November 2001, introduced <a
- href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/cwg_defects.html#178">Core
+ href="http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#178">Core
Issue 178</a> (among many other issues, of course).</p>
<p> That issue introduced the new concept of <code>value-initialization</code>
@@ -295,7 +295,7 @@ so for those compilers that need to have such a workaround, based on the
<br> operator T&amp;() { return x ; }
<br> T const &amp;data() const { return x ; }
<br> T&amp; data() { return x ; }
-<br> void swap( value_initialized&lt;T&gt;&amp; );
+<br> void swap( value_initialized&amp; );
<br>
<br> private :
<br> <i>unspecified</i> x ;
@@ -313,6 +313,12 @@ so for those compilers that need to have such a workaround, based on the
<br> return x.data() ;
<br>}
<br>
+<br>template&lt;class T&gt;
+<br>void swap ( value_initialized&lt;T&gt;&amp; lhs, value_initialized&lt;T&gt;&amp; rhs )
+<br>{
+<br> lhs.swap(rhs) ;
+<br>}
+<br>
<br>} // namespace boost
<br></pre>
@@ -385,7 +391,7 @@ the wrapped object is always performed with the <code>get()</code> idiom:</p>
<br> operator T&amp;();
<br> T const &amp;data() const;
<br> T&amp; data();
-<br> void swap( value_initialized&lt;T&gt;&amp; );
+<br> void swap( initialized&amp; );
<br>
<br> private :
<br> <i>unspecified</i> x ;
@@ -397,6 +403,9 @@ the wrapped object is always performed with the <code>get()</code> idiom:</p>
<br>template&lt;class T&gt;
<br>T&amp; get ( initialized&lt;T&gt;&amp; x );
<br>
+<br>template&lt;class T&gt;
+<br>void swap ( initialized&lt;T&gt;&amp; lhs, initialized&lt;T&gt;&amp; rhs );
+<br>
<br>} // namespace boost
<br></pre>
diff --git a/libs/utility/value_init_test.cpp b/libs/utility/value_init_test.cpp
index 98b8860297..bee8e10e2a 100644
--- a/libs/utility/value_init_test.cpp
+++ b/libs/utility/value_init_test.cpp
@@ -22,7 +22,7 @@
#pragma hdrstop
#endif
-#include "boost/test/minimal.hpp"
+#include <boost/detail/lightweight_test.hpp>
//
// Sample POD type
@@ -215,7 +215,7 @@ template<class T>
void check_initialized_value ( T const& y )
{
T initializedValue = boost::initialized_value ;
- BOOST_CHECK ( y == initializedValue ) ;
+ BOOST_TEST ( y == initializedValue ) ;
}
#ifdef __BORLANDC__
@@ -245,128 +245,125 @@ void check_initialized_value( NonPOD const& )
template<class T>
bool test ( T const& y, T const& z )
{
- const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter();
+ const int errors_before_test = boost::detail::test_errors();
check_initialized_value(y);
boost::value_initialized<T> x ;
- BOOST_CHECK ( y == x ) ;
- BOOST_CHECK ( y == boost::get(x) ) ;
+ BOOST_TEST ( y == x ) ;
+ BOOST_TEST ( y == boost::get(x) ) ;
static_cast<T&>(x) = z ;
boost::get(x) = z ;
- BOOST_CHECK ( x == z ) ;
+ BOOST_TEST ( x == z ) ;
boost::value_initialized<T> const x_c ;
- BOOST_CHECK ( y == x_c ) ;
- BOOST_CHECK ( y == boost::get(x_c) ) ;
+ BOOST_TEST ( y == x_c ) ;
+ BOOST_TEST ( y == boost::get(x_c) ) ;
T& x_c_ref = const_cast<T&>( boost::get(x_c) ) ;
x_c_ref = z ;
- BOOST_CHECK ( x_c == z ) ;
+ BOOST_TEST ( x_c == z ) ;
boost::value_initialized<T> const copy1 = x;
- BOOST_CHECK ( boost::get(copy1) == boost::get(x) ) ;
+ BOOST_TEST ( boost::get(copy1) == boost::get(x) ) ;
boost::value_initialized<T> copy2;
copy2 = x;
- BOOST_CHECK ( boost::get(copy2) == boost::get(x) ) ;
+ BOOST_TEST ( boost::get(copy2) == boost::get(x) ) ;
boost::shared_ptr<boost::value_initialized<T> > ptr( new boost::value_initialized<T> );
- BOOST_CHECK ( y == *ptr ) ;
+ BOOST_TEST ( y == *ptr ) ;
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
boost::value_initialized<T const> cx ;
- BOOST_CHECK ( y == cx ) ;
- BOOST_CHECK ( y == boost::get(cx) ) ;
+ BOOST_TEST ( y == cx ) ;
+ BOOST_TEST ( y == boost::get(cx) ) ;
boost::value_initialized<T const> const cx_c ;
- BOOST_CHECK ( y == cx_c ) ;
- BOOST_CHECK ( y == boost::get(cx_c) ) ;
+ BOOST_TEST ( y == cx_c ) ;
+ BOOST_TEST ( y == boost::get(cx_c) ) ;
#endif
- return boost::minimal_test::errors_counter() == counter_before_test ;
+ return boost::detail::test_errors() == errors_before_test ;
}
-int test_main(int, char **)
+int main(int, char **)
{
- BOOST_CHECK ( test( 0,1234 ) ) ;
- BOOST_CHECK ( test( 0.0,12.34 ) ) ;
- BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78f) ) ) ;
- BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
+ BOOST_TEST ( test( 0,1234 ) ) ;
+ BOOST_TEST ( test( 0.0,12.34 ) ) ;
+ BOOST_TEST ( test( POD(0,0,0.0), POD('a',1234,56.78f) ) ) ;
+ BOOST_TEST ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
NonPOD NonPOD_object( std::string("NonPOD_object") );
- BOOST_CHECK ( test<NonPOD *>( 0, &NonPOD_object ) ) ;
+ BOOST_TEST ( test<NonPOD *>( 0, &NonPOD_object ) ) ;
AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 };
AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 };
- BOOST_CHECK ( test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct) );
+ BOOST_TEST ( test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct) );
StringAndInt stringAndInt0;
StringAndInt stringAndInt1;
stringAndInt0.i = 0;
stringAndInt1.i = 1;
stringAndInt1.s = std::string("1");
- BOOST_CHECK ( test(stringAndInt0, stringAndInt1) );
+ BOOST_TEST ( test(stringAndInt0, stringAndInt1) );
StructWithDestructor structWithDestructor0;
StructWithDestructor structWithDestructor1;
structWithDestructor0.i = 0;
structWithDestructor1.i = 1;
- BOOST_CHECK ( test(structWithDestructor0, structWithDestructor1) );
+ BOOST_TEST ( test(structWithDestructor0, structWithDestructor1) );
StructWithVirtualFunction structWithVirtualFunction0;
StructWithVirtualFunction structWithVirtualFunction1;
structWithVirtualFunction0.i = 0;
structWithVirtualFunction1.i = 1;
- BOOST_CHECK ( test(structWithVirtualFunction0, structWithVirtualFunction1) );
+ BOOST_TEST ( test(structWithVirtualFunction0, structWithVirtualFunction1) );
DerivedFromAggregatePODStruct derivedFromAggregatePODStruct0;
DerivedFromAggregatePODStruct derivedFromAggregatePODStruct1;
static_cast<AggregatePODStruct &>(derivedFromAggregatePODStruct0) = zeroInitializedAggregatePODStruct;
static_cast<AggregatePODStruct &>(derivedFromAggregatePODStruct1) = nonZeroInitializedAggregatePODStruct;
- BOOST_CHECK ( test(derivedFromAggregatePODStruct0, derivedFromAggregatePODStruct1) );
+ BOOST_TEST ( test(derivedFromAggregatePODStruct0, derivedFromAggregatePODStruct1) );
AggregatePODStructWrapper aggregatePODStructWrapper0;
AggregatePODStructWrapper aggregatePODStructWrapper1;
aggregatePODStructWrapper0.dataMember = zeroInitializedAggregatePODStruct;
aggregatePODStructWrapper1.dataMember = nonZeroInitializedAggregatePODStruct;
- BOOST_CHECK ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) );
+ BOOST_TEST ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) );
ArrayOfBytes zeroInitializedArrayOfBytes = { 0 };
boost::value_initialized<ArrayOfBytes> valueInitializedArrayOfBytes;
- BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0);
+ BOOST_TEST (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0);
boost::value_initialized<ArrayOfBytes> valueInitializedArrayOfBytes2;
valueInitializedArrayOfBytes2 = valueInitializedArrayOfBytes;
- BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), get(valueInitializedArrayOfBytes2), sizeof(ArrayOfBytes)) == 0);
+ BOOST_TEST (std::memcmp(get(valueInitializedArrayOfBytes), get(valueInitializedArrayOfBytes2), sizeof(ArrayOfBytes)) == 0);
boost::value_initialized<CopyFunctionCallTester> copyFunctionCallTester1;
- BOOST_CHECK ( ! get(copyFunctionCallTester1).is_copy_constructed);
- BOOST_CHECK ( ! get(copyFunctionCallTester1).is_assignment_called);
+ BOOST_TEST ( ! get(copyFunctionCallTester1).is_copy_constructed);
+ BOOST_TEST ( ! get(copyFunctionCallTester1).is_assignment_called);
boost::value_initialized<CopyFunctionCallTester> copyFunctionCallTester2 = boost::value_initialized<CopyFunctionCallTester>(copyFunctionCallTester1);
- BOOST_CHECK ( get(copyFunctionCallTester2).is_copy_constructed);
- BOOST_CHECK ( ! get(copyFunctionCallTester2).is_assignment_called);
+ BOOST_TEST ( get(copyFunctionCallTester2).is_copy_constructed);
+ BOOST_TEST ( ! get(copyFunctionCallTester2).is_assignment_called);
boost::value_initialized<CopyFunctionCallTester> copyFunctionCallTester3;
copyFunctionCallTester3 = boost::value_initialized<CopyFunctionCallTester>(copyFunctionCallTester1);
- BOOST_CHECK ( ! get(copyFunctionCallTester3).is_copy_constructed);
- BOOST_CHECK ( get(copyFunctionCallTester3).is_assignment_called);
+ BOOST_TEST ( ! get(copyFunctionCallTester3).is_copy_constructed);
+ BOOST_TEST ( get(copyFunctionCallTester3).is_assignment_called);
boost::value_initialized<SwapFunctionCallTester> swapFunctionCallTester1;
boost::value_initialized<SwapFunctionCallTester> swapFunctionCallTester2;
get(swapFunctionCallTester1).data = 1;
get(swapFunctionCallTester2).data = 2;
boost::swap(swapFunctionCallTester1, swapFunctionCallTester2);
- BOOST_CHECK( get(swapFunctionCallTester1).data == 2 );
- BOOST_CHECK( get(swapFunctionCallTester2).data == 1 );
- BOOST_CHECK( get(swapFunctionCallTester1).is_custom_swap_called );
- BOOST_CHECK( get(swapFunctionCallTester2).is_custom_swap_called );
+ BOOST_TEST( get(swapFunctionCallTester1).data == 2 );
+ BOOST_TEST( get(swapFunctionCallTester2).data == 1 );
+ BOOST_TEST( get(swapFunctionCallTester1).is_custom_swap_called );
+ BOOST_TEST( get(swapFunctionCallTester2).is_custom_swap_called );
- return 0;
+ return boost::report_errors();
}
-unsigned int expected_failures = 0;
-
-
diff --git a/libs/utility/verify_test.cpp b/libs/utility/verify_test.cpp
deleted file mode 100644
index 3481636c74..0000000000
--- a/libs/utility/verify_test.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// verify_test.cpp - a test for BOOST_VERIFY
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-// Copyright (c) 2007 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/detail/lightweight_test.hpp>
-
-#include <boost/assert.hpp>
-
-int f( int & x )
-{
- return ++x;
-}
-
-void test_default()
-{
- int x = 1;
-
- BOOST_VERIFY( 1 );
- BOOST_VERIFY( x == 1 );
- BOOST_VERIFY( ++x );
- BOOST_VERIFY( f(x) );
- BOOST_VERIFY( &x );
-
- BOOST_TEST( x == 3 );
-}
-
-#define BOOST_DISABLE_ASSERTS
-#include <boost/assert.hpp>
-
-void test_disabled()
-{
- int x = 1;
-
- BOOST_VERIFY( 1 );
- BOOST_VERIFY( x == 1 );
- BOOST_VERIFY( ++x );
- BOOST_VERIFY( f(x) );
- BOOST_VERIFY( &x );
-
- BOOST_TEST( x == 3 );
-
- BOOST_VERIFY( 0 );
- BOOST_VERIFY( !x );
- BOOST_VERIFY( x == 0 );
- BOOST_VERIFY( !++x );
- BOOST_VERIFY( !f(x) );
-
- BOOST_TEST( x == 5 );
-
- void * p = 0;
- BOOST_VERIFY( p );
-}
-
-#undef BOOST_DISABLE_ASSERTS
-
-#define BOOST_ENABLE_ASSERT_HANDLER
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <cstdio>
-
-int handler_invoked = 0;
-
-void boost::assertion_failed(char const * expr, char const * function, char const * file, long line)
-{
-#if !defined(BOOST_NO_STDC_NAMESPACE)
- using std::printf;
-#endif
-
- printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line);
- ++handler_invoked;
-}
-
-struct X
-{
- static bool f()
- {
- BOOST_VERIFY( 0 );
- return false;
- }
-};
-
-void test_handler()
-{
- int x = 1;
-
- BOOST_VERIFY( 1 );
- BOOST_VERIFY( x == 1 );
- BOOST_VERIFY( ++x );
- BOOST_VERIFY( f(x) );
- BOOST_VERIFY( &x );
-
- BOOST_TEST( x == 3 );
-
- BOOST_VERIFY( 0 );
- BOOST_VERIFY( !x );
- BOOST_VERIFY( x == 0 );
- BOOST_VERIFY( !++x );
- BOOST_VERIFY( !f(x) );
-
- BOOST_TEST( x == 5 );
-
- void * p = 0;
- BOOST_VERIFY( p );
-
- BOOST_VERIFY( X::f() );
-
- BOOST_TEST( handler_invoked == 8 );
-}
-
-#undef BOOST_ENABLE_ASSERT_HANDLER
-
-int main()
-{
- test_default();
- test_disabled();
- test_handler();
-
- return boost::report_errors();
-}