From 13bdfb8bbdd4ad60da171050bf83e4c9eec7d57d Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:38:02 +0000 Subject: [PATCH] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41370] --- OptionalPointee.html | 10 ++++++++-- assert.html | 12 ++++++++--- compressed_pair.htm | 19 +++++++++--------- in_place_factories.html | 9 ++++----- test/Jamfile.v2 | 12 +++++------ test/none_test.cpp | 22 -------------------- test/result_of_test.cpp | 32 +++++++++++++++++++++++++++++ utility.htm | 18 ++++++++--------- value_init.htm | 20 +++++++++---------- value_init_test.cpp | 42 ++++++++++++++++++++++++++++++++------- value_init_test_fail1.cpp | 2 +- value_init_test_fail2.cpp | 2 +- value_init_test_fail3.cpp | 2 +- 13 files changed, 126 insertions(+), 76 deletions(-) delete mode 100644 test/none_test.cpp diff --git a/OptionalPointee.html b/OptionalPointee.html index a6d6d97..462d6f3 100644 --- a/OptionalPointee.html +++ b/OptionalPointee.html @@ -145,14 +145,20 @@ objects are is implemented in +

Acknowledgements

+

Based on the original concept developed by Augustus Saunders. +
+


Copyright © 2003 -Fernando Cacciola, -based on the original concept developed by Augustus Saunders. +Fernando Cacciola
+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/LICENSE_1_0.txt

+ \ No newline at end of file diff --git a/assert.html b/assert.html index 4381ae1..a970cef 100644 --- a/assert.html +++ b/assert.html @@ -47,9 +47,15 @@ void assertion_failed(char const * expr, char const * function, char const * fil

As is the case with <cassert>, <boost/assert.hpp> can be included multiple times in a single translation unit. BOOST_ASSERT will be redefined each time as specified above.

+

<boost/assert.hpp> also defines the macro BOOST_VERIFY. + It has exactly the same behavior as BOOST_ASSERT, except that + the expression that is passed to BOOST_VERIFY 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.


- Copyright © 2002 by 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.

+ Copyright © 2002, 2007 by 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.

diff --git a/compressed_pair.htm b/compressed_pair.htm index 4662fc5..f054d08 100644 --- a/compressed_pair.htm +++ b/compressed_pair.htm @@ -3,7 +3,7 @@ Header - + @@ -59,17 +59,18 @@ public: empty type, then assigning to that member will produce memory corruption, unless the empty type has a "do nothing" assignment operator defined. This is due to a bug in the way VC6 generates implicit assignment operators.

-
-

Revised 08 May 2001

-

© Copyright boost.org 2000. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+

Acknowledgements

Based on contributions by Steve Cleary, Beman Dawes, Howard Hinnant and John Maddock.

Maintained by John Maddock, the latest version of this file can be found at www.boost.org, and the boost discussion list at www.yahoogroups.com/list/boost.

-

 

+
+

Revised + 07 November 2007

+

© Copyright Beman Dawes, 2000.

+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/LICENSE_1_0.txt

+ - + \ No newline at end of file diff --git a/in_place_factories.html b/in_place_factories.html index 9b71559..b36387d 100644 --- a/in_place_factories.html +++ b/in_place_factories.html @@ -3,9 +3,8 @@ - - -Header + +In_place_factory Documentation @@ -77,7 +76,7 @@ object is likely to be temporary and serve no purpose besides being the source

A solution to this problem is to support direct construction of the contained object right in the container's storage.
-In this shceme, the user supplies the arguments for the X constructor +In this scheme, the user supplies the arguments for the X constructor directly to the container:

struct C
 {
@@ -138,7 +137,7 @@ The following simplified example shows the basic idea. A complete example follow
 
 void foo()
 {
-  C c( in_place(123,"hello" ) ;
+  C c( in_place(123,"hello") ) ;
 }
 
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 330c08c..56c84a4 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,8 +1,7 @@ -# Copyright David Abrahams 2003. Permission to copy, use, -# modify, sell and distribute this software is granted provided this -# copyright notice appears in all copies. This software is provided -# "as is" without express or implied warranty, and with no claim as -# to its suitability for any purpose. +# Copyright David Abrahams 2003. + +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt # For more information, see http://www.boost.org/ @@ -33,5 +32,6 @@ test-suite utility [ compile-fail ../value_init_test_fail1.cpp ] [ compile-fail ../value_init_test_fail2.cpp ] [ compile-fail ../value_init_test_fail3.cpp ] - [ run none_test.cpp ] + [ run ../verify_test.cpp ] ; + diff --git a/test/none_test.cpp b/test/none_test.cpp deleted file mode 100644 index 00a6fc9..0000000 --- a/test/none_test.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2007 Fernando Luis Cacciola Carballal. Use, modification, and distribution -// are subject to the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or a copy at -// http://www.boost.org/LICENSE_1_0.txt.) - -// See http://www.boost.org/libs/utility for documentation. - -// Boost test program for noost::none_t and boost::none - -// Test strategy contributed by Richard Smith - -#include // Test none.hpp is included with - -// Left undefined to cause a linker error if this overload is incorrectly selected. -void verify_no_implicit_conversion_to_int ( int i ) ; - -void verify_no_implicit_conversion_to_int ( boost::optional const& ) {} - -int main() -{ - verify_no_implicit_conversion_to_int( boost::none ); -} diff --git a/test/result_of_test.cpp b/test/result_of_test.cpp index af7aba2..10f3410 100644 --- a/test/result_of_test.cpp +++ b/test/result_of_test.cpp @@ -24,6 +24,24 @@ struct int_result_type_and_float_result_of template struct result { typedef float type; }; }; +template +struct int_result_type_template { typedef int result_type; }; + +template +struct int_result_of_template +{ + template struct result; + template struct result { typedef int type; }; +}; + +template +struct int_result_type_and_float_result_of_template +{ + typedef int result_type; + template struct result; + template struct result { typedef float type; }; +}; + struct X {}; int main() @@ -32,10 +50,13 @@ int main() typedef int (*func_ptr)(float, double); typedef int (&func_ref)(float, double); + typedef int (*func_ptr_0)(); + typedef int (&func_ref_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; typedef int (X::*mem_func_ptr_cv)(float) const volatile; + typedef int (X::*mem_func_ptr_0)(); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); @@ -43,11 +64,22 @@ int main() BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, void>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same(float)>::type, int>::value)); + BOOST_STATIC_ASSERT((is_same(double)>::type, int>::value)); + BOOST_STATIC_ASSERT((is_same(void)>::type, void>::value)); + BOOST_STATIC_ASSERT((is_same(double)>::type, int>::value)); + BOOST_STATIC_ASSERT((is_same(void)>::type, void>::value)); + BOOST_STATIC_ASSERT((is_same(char)>::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + return 0; } diff --git a/utility.htm b/utility.htm index 8d8d80f..937a8a3 100644 --- a/utility.htm +++ b/utility.htm @@ -163,9 +163,9 @@ void f() { N > 0 or void when N = 0. For additional information about result_of, see the - current draft of the C++ Library TR, N1647, - or the result_of N1836, + or, for motivation and design rationale, the result_of proposal.

Class template result_of resides in @@ -183,12 +183,12 @@ void f() {

See separate documentation.


Revised  02 May, 200407 November, 2007

-

© Copyright boost.org 1999-2003. Permission to copy, use, modify, sell and distribute - this document is granted provided this copyright notice appears in all copies. - This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+

© Copyright Beman Dawes 1999-2003.

+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/LICENSE_1_0.txt

+ - + \ No newline at end of file diff --git a/value_init.htm b/value_init.htm index d8c28e3..8ceba8b 100644 --- a/value_init.htm +++ b/value_init.htm @@ -197,23 +197,23 @@ the wrapped object is always performed with the get() idiom:

value_initialized was developed by Fernando Cacciola, with help and suggestions from David Abrahams and Darin Adler.
Special thanks to Björn Karlsson who carefully edited and completed this documentation. -
 
- -
-

Revised 19 September 2002

- -

© Copyright boost.org 2002. Permission to copy, use, modify, sell -and distribute this document is granted provided this copyright notice appears -in all copies. This document is provided "as is" without express or implied -warranty, and with no claim as to its suitability for any purpose.

Developed by Fernando Cacciola, the latest version of this file can be found at www.boost.org, and the boost discussion list at www.yahoogroups.com/list/boost.

+ +
+

Revised 19 September 2002

+ +

© Copyright Fernando Cacciola, 2002.

+ +

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/LICENSE_1_0.txt

+

- + \ No newline at end of file diff --git a/value_init_test.cpp b/value_init_test.cpp index fe73cc1..4c576a6 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -1,4 +1,4 @@ -// (C) 2002, Fernando Luis Cacciola Carballal. +// Copyright 2002, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -60,9 +60,29 @@ struct NonPOD : NonPODBase std::string id ; } ; -template -void test ( T const& y, T const& z ) +// +// Sample aggregate POD struct type +// +struct AggregatePODStruct { + float f; + char c; + int i; +}; + +bool operator == ( AggregatePODStruct const& lhs, AggregatePODStruct const& rhs ) +{ return lhs.f == rhs.f && lhs.c == rhs.c && lhs.i == rhs.i ; } + + +// +// This test function tests boost::value_initialized for a specific type T. +// The first argument (y) is assumed have the value of a value-initialized object. +// Returns true on success. +// +template +bool test ( T const& y, T const& z ) +{ + const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter(); boost::value_initialized x ; BOOST_CHECK ( y == x ) ; BOOST_CHECK ( y == boost::get(x) ) ; @@ -86,14 +106,22 @@ void test ( T const& y, T const& z ) BOOST_CHECK ( y == cx_c ) ; BOOST_CHECK ( y == boost::get(cx_c) ) ; #endif + return boost::minimal_test::errors_counter() == counter_before_test ; } int test_main(int, char **) { - test( 0,1234 ) ; - test( 0.0,12.34 ) ; - test( POD(0,0,0.0), POD('a',1234,56.78) ) ; - test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ; + BOOST_CHECK ( test( 0,1234 ) ) ; + BOOST_CHECK ( test( 0.0,12.34 ) ) ; + BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78) ) ) ; + BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ; + + NonPOD NonPOD_object( std::string("NonPOD_object") ); + BOOST_CHECK ( test( 0, &NonPOD_object ) ) ; + + AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 }; + AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 }; + BOOST_CHECK ( test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct) ); return 0; } diff --git a/value_init_test_fail1.cpp b/value_init_test_fail1.cpp index 8904732..e3f6f1a 100644 --- a/value_init_test_fail1.cpp +++ b/value_init_test_fail1.cpp @@ -1,4 +1,4 @@ -// (C) 2002, Fernando Luis Cacciola Carballal. +// Copyright 2002, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/value_init_test_fail2.cpp b/value_init_test_fail2.cpp index 1f40061..bbc7c90 100644 --- a/value_init_test_fail2.cpp +++ b/value_init_test_fail2.cpp @@ -1,4 +1,4 @@ -// (C) 2002, Fernando Luis Cacciola Carballal. +// Copyright 2002, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/value_init_test_fail3.cpp b/value_init_test_fail3.cpp index 72fd761..9bea5ba 100644 --- a/value_init_test_fail3.cpp +++ b/value_init_test_fail3.cpp @@ -1,4 +1,4 @@ -// (C) 2002, Fernando Luis Cacciola Carballal. +// Copyright 2002, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at