From d809d4e832c4b0971a0ce3d3d35df6da445093fe Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 21 Mar 2006 02:26:31 +0000 Subject: [PATCH 01/34] This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'. [SVN r33417] From d968b5f5b9b733a7c3b3d765604c8888732e6ea5 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Thu, 27 Jul 2006 11:48:49 +0000 Subject: [PATCH 02/34] boost guidelines (mainly from inspect tool: tabs, license reference text, etc.); more to do... [SVN r34753] --- include/boost/utility/value_init.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index d991486..3d44491 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -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 From 505d419a1b9daef0221bcd987261ba1ade342912 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Fri, 8 Sep 2006 00:16:31 +0000 Subject: [PATCH 03/34] Resolved an ambiguity. [SVN r35039] --- include/boost/utility/value_init.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index 3d44491..d24908c 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -40,7 +40,7 @@ template struct select_base { typedef typename - detail::if_true< ::boost::is_const::value > + boost::detail::if_true< ::boost::is_const::value > ::template then< const_T_base, non_const_T_base >::type type ; } ; From 6dd93ab91631827b98ad746be5478d026c6cec8c Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 16 Oct 2006 18:01:40 +0000 Subject: [PATCH 04/34] Removed unneeded semicolon. [SVN r35636] --- call_traits.htm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/call_traits.htm b/call_traits.htm index 53f093e..6d9bddf 100644 --- a/call_traits.htm +++ b/call_traits.htm @@ -606,7 +606,7 @@ template <bool opt> struct filler { template <typename I, typename T> - static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val); + static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val) { while(first != last) { @@ -762,3 +762,4 @@ href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost.

 

+ From 95da2e90de755facd0046990a7c24ef131a4183f Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 6 Nov 2006 17:10:46 +0000 Subject: [PATCH 05/34] Remove obsolete Boost.Build v1 files. [SVN r35880] --- enable_if/test/Jamfile | 33 -------------------------------- test/Jamfile | 43 ------------------------------------------ 2 files changed, 76 deletions(-) delete mode 100644 enable_if/test/Jamfile delete mode 100755 test/Jamfile diff --git a/enable_if/test/Jamfile b/enable_if/test/Jamfile deleted file mode 100644 index f2e5ee3..0000000 --- a/enable_if/test/Jamfile +++ /dev/null @@ -1,33 +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/ - -subproject libs/utility/enable_if/test ; - -# bring in rules for testing -import testing ; - -# Make tests run by default. -DEPENDS all : test ; - -{ - local test_monitor = @boost/libs/test/build/boost_test_exec_monitor ; - - # look in BOOST_ROOT for sources first, just in this Jamfile - local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ; - - test-suite utility/enable_if - : - [ run libs/utility/enable_if/test/constructors.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/dummy_arg_disambiguation.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/lazy.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/lazy_test.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/member_templates.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/namespace_disambiguation.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/no_disambiguation.cpp $(test_monitor) ] - [ run libs/utility/enable_if/test/partial_specializations.cpp $(test_monitor) ] - ; -} diff --git a/test/Jamfile b/test/Jamfile deleted file mode 100755 index 89d77d0..0000000 --- a/test/Jamfile +++ /dev/null @@ -1,43 +0,0 @@ -# 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. - -# For more information, see http://www.boost.org/ - -subproject libs/utility/test ; - -# bring in rules for testing -import testing ; - -# Make tests run by default. -DEPENDS all : test ; - -local test_monitor = @boost/libs/test/build/boost_test_exec_monitor ; - -# Please keep the tests ordered by filename -test-suite utility - : - [ run ../addressof_test.cpp ] - [ run ../assert_test.cpp ] - [ run ../base_from_member_test.cpp ] - [ run ../binary_search_test.cpp ] - [ run ../call_traits_test.cpp : -u ] - [ compile-fail ../checked_delete_test.cpp ] - [ run ../compressed_pair_test.cpp $(test_monitor) : -u ] - [ run ../current_function_test.cpp : : : always_show_run_output ] - [ run ../iterators_test.cpp $(test_monitor) ] - [ run next_prior_test.cpp $(test_monitor) ] - [ compile-fail ../noncopyable_test.cpp ] - [ run ../numeric_traits_test.cpp ] - [ run ../operators_test.cpp $(test_monitor) ] - [ compile ../ref_ct_test.cpp ] - [ run ../ref_test.cpp $(test_monitor) ] - [ compile result_of_test.cpp ] - [ run ../shared_iterator_test.cpp ] - [ run ../value_init_test.cpp ] - [ compile-fail ../value_init_test_fail1.cpp ] - [ compile-fail ../value_init_test_fail2.cpp ] - [ compile-fail ../value_init_test_fail3.cpp ] - ; From ee3551e8dc1b4ba92d6af74fae49ba01dc8b1b58 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 7 Nov 2006 19:27:00 +0000 Subject: [PATCH 06/34] Merged copyright and license addition [SVN r35907] --- index.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 677539c..daf785e 100644 --- a/index.html +++ b/index.html @@ -27,8 +27,13 @@ value_init


+

© Copyright Beman Dawes, 2001

+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file + LICENSE_1_0.txt or copy at + + www.boost.org/LICENSE_1_0.txt)

Revised - 01 September, 2003

-

 

- - + 07 November, 2006

+ + \ No newline at end of file From 3c7b4094602c652d22393747947a796c49aaa02f Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 9 Nov 2006 20:34:33 +0000 Subject: [PATCH 07/34] License/copyright edits [SVN r35958] --- assert.html | 7 +++---- checked_delete.html | 7 +++---- current_function.html | 7 +++---- throw_exception.html | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/assert.html b/assert.html index a3dec66..4381ae1 100644 --- a/assert.html +++ b/assert.html @@ -48,9 +48,8 @@ void assertion_failed(char const * expr, char const * function, char const * fil can be included multiple times in a single translation unit. BOOST_ASSERT will be redefined each time as specified above.


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

diff --git a/checked_delete.html b/checked_delete.html index c123fd5..33b5bcb 100644 --- a/checked_delete.html +++ b/checked_delete.html @@ -115,9 +115,8 @@ template<class T> struct checked_array_deleter


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

diff --git a/current_function.html b/current_function.html index f383e3a..373eb22 100644 --- a/current_function.html +++ b/current_function.html @@ -29,9 +29,8 @@ function. On such compilers, the string literal has an unspecified value.


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

diff --git a/throw_exception.html b/throw_exception.html index 89466fb..66a63f3 100644 --- a/throw_exception.html +++ b/throw_exception.html @@ -51,9 +51,8 @@ template<class E> void throw_exception(E const & e) }


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

From d9f8bae673d56ee7425f32657ac9e19310c6f14f Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 10 Nov 2006 19:59:52 +0000 Subject: [PATCH 08/34] Merge from HEAD. Allow building of shared versions of some Boost.Test libraries. Adjust tests to use always use static linking to Boost.Test, since linking to the shared version requires test changes. Patch from Juergen Hunold. [SVN r35990] --- test/Jamfile.v2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 493011d..d5ecaa0 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -18,15 +18,15 @@ test-suite utility [ run ../binary_search_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 : -u ] + [ run ../compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor/static : -u ] [ run ../current_function_test.cpp : : : always_show_run_output ] - [ run ../iterators_test.cpp ../../test/build//boost_test_exec_monitor ] - [ run next_prior_test.cpp ../../test/build//boost_test_exec_monitor ] + [ run ../iterators_test.cpp ../../test/build//boost_test_exec_monitor/static ] + [ run next_prior_test.cpp ../../test/build//boost_test_exec_monitor/static ] [ compile-fail ../noncopyable_test.cpp ] [ run ../numeric_traits_test.cpp ] - [ run ../operators_test.cpp ../../test/build//boost_test_exec_monitor ] + [ run ../operators_test.cpp ../../test/build//boost_test_exec_monitor/static ] [ compile ../ref_ct_test.cpp ] - [ run ../ref_test.cpp ../../test/build//boost_test_exec_monitor ] + [ run ../ref_test.cpp ../../test/build//boost_test_exec_monitor/static ] [ compile result_of_test.cpp ] [ run ../shared_iterator_test.cpp ] [ run ../value_init_test.cpp ] From 30a40f9f76111c31928165f132bb60aa6d151e8b Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 4 Dec 2006 20:31:38 +0000 Subject: [PATCH 09/34] Linked to current_function.html [SVN r36268] --- index.html | 1 + utility.htm | 1 + 2 files changed, 2 insertions(+) diff --git a/index.html b/index.html index daf785e..1d2bffb 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,7 @@ call_traits
checked_delete
compressed_pair
+ current_function
enable_if
iterator_adaptors
operators
diff --git a/utility.htm b/utility.htm index 16616ad..8d8d80f 100644 --- a/utility.htm +++ b/utility.htm @@ -23,6 +23,7 @@
  • Function template addressof()
  • Class template result_of
  • +
  • Other utilities not part of utility.hpp
  • Function templates checked_delete() and From 09f7aab52dbeff7507e07ed11ac302d1c79916b5 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 5 Dec 2006 22:33:21 +0000 Subject: [PATCH 10/34] Merged L & C issue fixes & HTML conversions from trunk to branch. [SVN r36281] --- Assignable.html | 199 ++++--- Collection.html | 1036 ++++++++++++++++------------------- CopyConstructible.html | 303 +++++----- LessThanComparable.html | 394 +++++++------ MultiPassInputIterator.html | 157 +++--- generator_iterator.htm | 173 +++--- 6 files changed, 1065 insertions(+), 1197 deletions(-) diff --git a/Assignable.html b/Assignable.html index 557f4e7..54934f1 100644 --- a/Assignable.html +++ b/Assignable.html @@ -1,116 +1,109 @@ - - - -Assignable - - -C++ Boost - -
    -

    Assignable

    + -

    Description

    -A type is Assignable if it is possible to assign one object of the type -to another object of that type. + + + + + Assignable + -

    Notation

    - - - - - + + C++ Boost
    - - - - +

    Assignable

    - - - - +

    Description

    -
    -T - -is type that is a model of Assignable -
    -t - -is an object of type T -
    -u - -is an object of type T or possibly const T -
    -

    Definitions

    -

    Valid expressions

    - - - - - - - - - - - - - +

    A type is Assignable if it is possible to assign one object of the type + to another object of that type.

    -
    -Name - -Expression - -Return type - -Semantics -
    -Assignment - -t = u - -T& - -t is equivalent to u -
    +

    Notation

    + + + -
    T
    -

    Models

    + is type that is a model of Assignable + -
      -
    • int -
    • std::pair -
    + + t -

    See also

    -DefaultConstructible -and -CopyConstructible + is an object of type T + -
    -
    - - -
    Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) -
    + + u - - + is an object of type T or possibly const + T + + + +

    Definitions

    + +

    Valid expressions

    + + + + + + + + + + + + + + + + + + + + + +
    NameExpressionReturn typeSemantics
    Assignmentt = uT&t is equivalent to u
    + +

    Models

    + +
      +
    • int
    • + +
    • std::pair
    • +
    + +

    See also

    + +

    DefaultConstructible + and CopyConstructible

    +
    + +

    Valid HTML 4.01 Transitional

    + +

    Revised + 05 December, 2006

    + + + + + + + +
    Copyright © 2000Jeremy Siek, Univ.of + Notre Dame (jsiek@lsc.nd.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)

    + + diff --git a/Collection.html b/Collection.html index 9069e28..c811e7e 100644 --- a/Collection.html +++ b/Collection.html @@ -1,244 +1,190 @@ - - - -Collection - + - -

    - boost logo -
    Collection -

    + + + + -

    Description

    + Collection + -A Collection is a concept similar to the STL Container -concept. A Collection provides iterators for accessing a range of -elements and provides information about the number of elements in the -Collection. However, a Collection has fewer requirements than a -Container. The motivation for the Collection concept is that there are -many useful Container-like types that do not meet the full -requirements of Container, and many algorithms that can be written -with this reduced set of requirements. To summarize the reduction -in requirements: + +

    boost logo
    + Collection

    -
      -
    • It is not required to "own" its elements: the lifetime -of an element in a Collection does not have to match the lifetime of -the Collection object, though the lifetime of the element should cover -the lifetime of the Collection object. -
    • The semantics of copying a Collection object is not defined (it -could be a deep or shallow copy or not even support copying). -
    • The associated reference type of a Collection does -not have to be a real C++ reference. -
    +

    Description

    +

    A Collection is a concept similar to the STL Container concept. A + Collection provides iterators for accessing a range of elements and + provides information about the number of elements in the Collection. + However, a Collection has fewer requirements than a Container. The + motivation for the Collection concept is that there are many useful + Container-like types that do not meet the full requirements of Container, + and many algorithms that can be written with this reduced set of + requirements. To summarize the reduction in requirements:

    -Because of the reduced requirements, some care must be taken when -writing code that is meant to be generic for all Collection types. -In particular, a Collection object should be passed by-reference -since assumptions can not be made about the behaviour of the -copy constructor. +
      +
    • It is not required to "own" its elements: the lifetime of an element + in a Collection does not have to match the lifetime of the Collection + object, though the lifetime of the element should cover the lifetime of + the Collection object.
    • -

      +

    • The semantics of copying a Collection object is not defined (it could + be a deep or shallow copy or not even support copying).
    • -

      Associated types

      +
    • The associated reference type of a Collection does not have to be a + real C++ reference.
    • +
    Because of the reduced requirements, some care must be taken when + writing code that is meant to be generic for all Collection types. In + particular, a Collection object should be passed by-reference since + assumptions can not be made about the behaviour of the copy constructor. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Value type - -X::value_type - -The type of the object stored in a Collection. -If the Collection is mutable then -the value type must be Assignable. -Otherwise the value type must be CopyConstructible. -
    -Iterator type - -X::iterator - -The type of iterator used to iterate through a Collection's - elements. The iterator's value type is expected to be the - Collection's value type. A conversion - from the iterator type to the const iterator type must exist. - The iterator type must be an InputIterator. -
    -Const iterator type - -X::const_iterator - -A type of iterator that may be used to examine, but not to modify, - a Collection's elements. -
    -Reference type - -X::reference - -A type that behaves like a reference to the Collection's value type. -[1] -
    -Const reference type - -X::const_reference - -A type that behaves like a const reference to the Collection's value type. -
    -Pointer type - -X::pointer - -A type that behaves as a pointer to the Collection's value type. -
    -Distance type - -X::difference_type - -A signed integral type used to represent the distance between two - of the Collection's iterators. This type must be the same as - the iterator's distance type. -
    -Size type - -X::size_type - -An unsigned integral type that can represent any nonnegative value - of the Collection's distance type. -
    -

    Notation

    - - - - - - - - - - - - - -
    -X - -A type that is a model of Collection. -
    -a, b - -Object of type X. -
    -T - -The value type of X. -
    +

    Associated types

    -

    Valid expressions

    + + + -The following expressions must be valid. -

    +

    -
    Value typeX::value_type
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Name - -Expression - -Return type -
    -Beginning of range - -a.begin() - -iterator if a is mutable, const_iterator otherwise -
    -End of range - -a.end() - -iterator if a is mutable, const_iterator otherwise -
    -Size - -a.size() - -size_type -
    -Empty Collection - -a.empty() - -Convertible to bool -
    -Swap - -a.swap(b) - -void -
    -

    Expression semantics

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Name - -Expression - -Semantics - -Postcondition -
    -
    -Beginning of range - -a.begin() - -Returns an iterator pointing to the first element in the Collection. - -a.begin() is either dereferenceable or past-the-end. It is - past-the-end if and only if a.size() == 0. -
    -End of range - -a.end() - -Returns an iterator pointing one past the last element in the - Collection. - -a.end() is past-the-end. -
    -Size - -a.size() - -Returns the size of the Collection, that is, its number of elements. - -a.size() >= 0 -
    -Empty Collection - -a.empty() - -Equivalent to a.size() == 0. (But possibly faster.) - -  -
    -Swap - -a.swap(b) - -Equivalent to swap(a,b) - -  -
    -

    Complexity guarantees

    -begin() and end() are amortized constant time. -

    -size() is at most linear in the Collection's -size. empty() is amortized constant time. -

    -swap() is at most linear in the size of the two collections. -

    Invariants

    - - - - - - - - - - - - - -
    -Valid range - -For any Collection a, [a.begin(), a.end()) is a valid - range. -
    -Range size - -a.size() is equal to the distance from a.begin() to a.end(). -
    -Completeness - -An algorithm that iterates through the range [a.begin(), a.end()) - will pass through every element of a. -
    + + Empty Collection + a.empty() -

    Models

    -
      -
    • array -
    • array_ptr -
    • vector<bool> -
    + Equivalent to a.size() == 0. (But possibly + faster.) +   + -

    Collection Refinements

    + + Swap -There are quite a few concepts that refine the Collection concept, -similar to the concepts that refine the Container concept. Here -is a brief overview of the refining concepts. + a.swap(b) -

    ForwardCollection

    -The elements are arranged in some order that -does not change spontaneously from one iteration to the next. As -a result, a ForwardCollection is -EqualityComparable -and -LessThanComparable. -In addition, the iterator type of a ForwardCollection is a -MultiPassInputIterator which is just an InputIterator with the added -requirements that the iterator can be used to make multiple passes -through a range, and that if it1 == it2 and it1 is -dereferenceable then ++it1 == ++it2. The ForwardCollection -also has a front() method. + Equivalent to swap(a,b) -

    - - - - - - - + + +
    -Name - -Expression - -Return type - -Semantics -
     
    - - -Front - - -a.front() - - -reference if a is mutable,
    const_reference -otherwise. - - -Equivalent to *(a.begin()). - - +

    Complexity guarantees

    - +

    begin() and end() are amortized constant time.

    +

    size() is at most linear in the Collection's size. + empty() is amortized constant time.

    -

    ReversibleCollection

    +

    swap() is at most linear in the size of the two + collections.

    -The container provides access to iterators that traverse in both -directions (forward and reverse). The iterator type must meet all of -the requirements of -BidirectionalIterator -except that the reference type does not have to be a real C++ -reference. The ReversibleCollection adds the following requirements -to those of ForwardCollection. -

    +

    Invariants

    - - - - - - - - - - - - - - - - - - - +
    -Name - -Expression - -Return type - -Semantics -
    -Beginning of range - -a.rbegin() - -reverse_iterator if a is mutable, -const_reverse_iterator otherwise. - -Equivalent to X::reverse_iterator(a.end()). -
    -End of range - -a.rend() - -reverse_iterator if a is mutable, -const_reverse_iterator otherwise. - -Equivalent to X::reverse_iterator(a.begin()). -
    + + - - - - - - + + -
    Valid range
    -Back - -a.back() - -reference if a is mutable,
    const_reference -otherwise. -
    -Equivalent to *(--a.end()). -
    For any Collection a, [a.begin(), + a.end()) is a valid range.
    + + Range size -

    SequentialCollection

    + a.size() is equal to the distance from + a.begin() to a.end(). + -The elements are arranged in a strict linear order. No extra methods -are required. + + Completeness -

    RandomAccessCollection

    + An algorithm that iterates through the range + [a.begin(), a.end()) will pass through every element of + a. + + -The iterators of a RandomAccessCollection satisfy all of the -requirements of RandomAccessIterator -except that the reference type does not have to be a real C++ -reference. In addition, a RandomAccessCollection provides -an element access operator. +

    Models

    -

    +

      +
    • array
    • - - - - - - - - - - - - - +
    • array_ptr
    • -
      -Name - -Expression - -Return type - -Semantics -
      -Element Access - -a[n] - -reference if a is mutable, -const_reference otherwise. - -Returns the nth element of the Collection. -n must be convertible to size_type. -Precondition: 0 <= n < a.size(). -
      +
    • vector<bool>
    • +
    -

    Notes

    +

    Collection Refinements

    -

    [1] +

    There are quite a few concepts that refine the Collection concept, + similar to the concepts that refine the Container concept. Here is a brief + overview of the refining concepts.

    -The reference type does not have to be a real C++ reference. The -requirements of the reference type depend on the context within which -the Collection is being used. Specifically it depends on the -requirements the context places on the value type of the Collection. -The reference type of the Collection must meet the same requirements -as the value type. In addition, the reference objects must be -equivalent to the value type objects in the collection (which is -trivially true if they are the same object). Also, in a mutable -Collection, an assignment to the reference object must result in an -assignment to the object in the Collection (again, which is trivially -true if they are the same object, but non-trivial if the reference -type is a proxy class). +

    ForwardCollection

    -

    See also

    -Container +

    The elements are arranged in some order that does not change + spontaneously from one iteration to the next. As a result, a + ForwardCollection is EqualityComparable + and LessThanComparable. + In addition, the iterator type of a ForwardCollection is a + MultiPassInputIterator which is just an InputIterator with the added + requirements that the iterator can be used to make multiple passes through + a range, and that if it1 == it2 and it1 is + dereferenceable then ++it1 == ++it2. The ForwardCollection also + has a front() method.

    + + + -
    -
    -
    Name
    - -
    Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame and C++ Library & Compiler Group/SGI (jsiek@engr.sgi.com) -
    + Expression - - + Return type + + Semantics + + + + Front + + a.front() + + reference if a is mutable,
    + const_reference otherwise. + + Equivalent to *(a.begin()). + + + +

    ReversibleCollection

    + +

    The container provides access to iterators that traverse in both + directions (forward and reverse). The iterator type must meet all of the + requirements of BidirectionalIterator + except that the reference type does not have to be a real C++ reference. + The ReversibleCollection adds the following requirements to those of + ForwardCollection.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameExpressionReturn typeSemantics
    Beginning of rangea.rbegin()reverse_iterator if a is mutable, + const_reverse_iterator otherwise.Equivalent to + X::reverse_iterator(a.end()).
    End of rangea.rend()reverse_iterator if a is mutable, + const_reverse_iterator otherwise.Equivalent to + X::reverse_iterator(a.begin()).
    Backa.back()reference if a is mutable,
    + const_reference otherwise.
    Equivalent to *(--a.end()).
    + +

    SequentialCollection

    + +

    The elements are arranged in a strict linear order. No extra methods are + required.

    + +

    RandomAccessCollection

    + +

    The iterators of a RandomAccessCollection satisfy all of the + requirements of RandomAccessIterator + except that the reference type does not have to be a real C++ reference. In + addition, a RandomAccessCollection provides an element access operator.

    + + + + + + + + + + + + + + + + + + + + + +
    NameExpressionReturn typeSemantics
    Element Accessa[n]reference if a is mutable, + const_reference otherwise.Returns the nth element of the Collection. n + must be convertible to size_type. Precondition: 0 <= n + < a.size().
    + +

    Notes

    + +

    [1] The reference type does not have to be a + real C++ reference. The requirements of the reference type depend on the + context within which the Collection is being used. Specifically it depends + on the requirements the context places on the value type of the Collection. + The reference type of the Collection must meet the same requirements as the + value type. In addition, the reference objects must be equivalent to the + value type objects in the collection (which is trivially true if they are + the same object). Also, in a mutable Collection, an assignment to the + reference object must result in an assignment to the object in the + Collection (again, which is trivially true if they are the same object, but + non-trivial if the reference type is a proxy class).

    + +

    See also

    + +

    Container

    +
    + +

    Valid HTML 4.01 Transitional

    + +

    Revised + 05 + December, 2006

    + + + + + + + +
    Copyright © 2000Jeremy + Siek, Univ.of Notre Dame and C++ Library & Compiler Group/SGI + (jsiek@engr.sgi.com)
    + +

    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/CopyConstructible.html b/CopyConstructible.html index f2d6308..40ff7a7 100644 --- a/CopyConstructible.html +++ b/CopyConstructible.html @@ -1,178 +1,139 @@ - - - -Copy Constructible - - -C++ Boost - -
    -

    Copy Constructible

    + -

    Description

    -A type is Copy Constructible if it is possible to copy objects of that -type. + + + + -

    Notation

    - - - - - + Copy Constructible + - - - - + + C++ Boost
    - - - - +

    Copy Constructible

    -
    -T - -is type that is a model of Copy Constructible -
    -t - -is an object of type T -
    -u - -is an object of type const T -
    -

    Definitions

    -

    Valid expressions

    - - - - - - - - - - - - - +

    Description

    +

    A type is Copy Constructible if it is possible to copy objects of that + type.

    - - -
    -Name - -Expression - -Return type - -Semantics -
    -Copy constructor - -T(t) - -T - -t is equivalent to T(t) -
    -Copy constructor - -
    +  

    Notation

    + + + + + + + + + + + + + + + + + + + +
    Tis type that is a model of Copy Constructible
    tis an object of type T
    uis an object of type const T
    + +

    Definitions

    + +

    Valid expressions

    + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + + + + + + - - - + - - - + + + + + + + + - - - + - - - + + + + + + + + - - - + + + + +
    NameExpressionReturn typeSemantics
    Copy constructorT(t)Tt is equivalent to T(t)
    Copy constructor +
     T(u)
     
    -
    -T - -u is equivalent to T(u) -
    T
    -Destructor - -
    +      
    u is equivalent to T(u)
    Destructor +
     t.~T()
     
    -
    -T - -  -
    -Address Operator - -
    +      
    T 
    Address Operator +
     &t
     
    -
    -T* - -denotes the address of t -
    -Address Operator - -
    +      
    T*denotes the address of t
    Address Operator +
     &u
     
    -
    -T* - -denotes the address of u -
    T*denotes the address of u
    -
    +

    Models

    +
      +
    • int
    • - -

      Models

      +
    • std::pair
    • +
    -
      -
    • int -
    • std::pair -
    - -

    Concept Checking Class

    - -
    +  

    Concept Checking Class

    +
       template <class T>
       struct CopyConstructibleConcept
       {
    @@ -192,19 +153,33 @@ denotes the address of u
       };
     
    -

    See also

    -Default Constructible -and -Assignable +

    See also

    -
    -
    - - -
    Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) -
    +

    Default + Constructible and Assignable

    +
    - - +

    Valid HTML 4.01 Transitional

    + +

    Revised + 05 + December, 2006

    + + + + + + + +
    Copyright © 2000Jeremy Siek, Univ.of + Notre Dame (jsiek@lsc.nd.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)

    + + diff --git a/LessThanComparable.html b/LessThanComparable.html index 8913b38..a723377 100644 --- a/LessThanComparable.html +++ b/LessThanComparable.html @@ -1,212 +1,210 @@ - + + + - - -LessThanComparable - - -C++ Boost - -
    -

    LessThanComparable

    -

    Description

    -A type is LessThanComparable if it is ordered: it must -be possible to compare two objects of that type using operator<, and -operator< must be a strict weak ordering relation. + + + + LessThanComparable + -

    Refinement of

    -

    Associated types

    -

    Notation

    - - - - - - - - - -
    -X - -A type that is a model of LessThanComparable -
    -x, y, z - -Object of type X -
    -

    Definitions

    -Consider the relation !(x < y) && !(y < x). If this relation is -transitive (that is, if !(x < y) && !(y < x) && !(y < z) && !(z < y) -implies !(x < z) && !(z < x)), then it satisfies the mathematical -definition of an equivalence relation. In this case, operator< -is a strict weak ordering. -

    -If operator< is a strict weak ordering, and if each equivalence class -has only a single element, then operator< is a total ordering. -

    Valid expressions

    - - - - - - - - - - - - - -
    -Name - -Expression - -Type requirements - -Return type -
    -Less - -x < y - -  - -Convertible to bool -
    + + C++ Boost
    +

    LessThanComparable

    +

    Description

    -

    Expression semantics

    - - - - - - - - - - - - - -
    -Name - -Expression - -Precondition - -Semantics - -Postcondition -
    -Less - -x < y - -x and y are in the domain of < - -  -
    +

    A type is LessThanComparable if it is ordered: it must be possible to + compare two objects of that type using operator<, and + operator< must be a strict weak ordering relation.

    +

    Refinement of

    -

    Complexity guarantees

    -

    Invariants

    - - - - - - - - - - - - - -
    -Irreflexivity - -x < x must be false. -
    -Antisymmetry - -x < y implies !(y < x) [2] -
    -Transitivity - -x < y and y < z implies x < z [3] -
    -

    Models

    -
      -
    • -int -
    -

    Notes

    -

    [1] -Only operator< is fundamental; the other inequality operators -are essentially syntactic sugar. -

    [2] -Antisymmetry is a theorem, not an axiom: it follows from -irreflexivity and transitivity. -

    [3] -Because of irreflexivity and transitivity, operator< always -satisfies the definition of a partial ordering. The definition of -a strict weak ordering is stricter, and the definition of a -total ordering is stricter still. -

    See also

    -EqualityComparable, StrictWeakOrdering +

    Associated types

    +

    Notation

    + + + -
    -
    -
    X
    - -
    Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) -
    + A type that is a model of LessThanComparable + - - + + x, y, z + + Object of type X + + + +

    Definitions

    + +

    Consider the relation !(x < y) && !(y < x). If + this relation is transitive (that is, if !(x < y) && !(y + < x) && !(y < z) && !(z < y) implies !(x + < z) && !(z < x)), then it satisfies the mathematical + definition of an equivalence relation. In this case, operator< + is a strict weak ordering.

    + +

    If operator< is a strict weak ordering, and if each + equivalence class has only a single element, then operator< is + a total ordering.

    + +

    Valid expressions

    + + + + + + + + + + + + + + + + + + + + + +
    NameExpressionType requirementsReturn type
    Lessx < y Convertible to bool
    + +

    Expression semantics

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameExpressionPreconditionSemanticsPostcondition
    Lessx < yx and y are in the domain of + < 
    + +

    Complexity guarantees

    + +

    Invariants

    + + + + + + + + + + + + + + + + + + + +
    Irreflexivityx < x must be false.
    Antisymmetryx < y implies !(y < x) [2]
    Transitivityx < y and y < z implies x + < z [3]
    + +

    Models

    + +
      +
    • int
    • +
    + +

    Notes

    + +

    [1] Only operator< is fundamental; + the other inequality operators are essentially syntactic sugar.

    + +

    [2] Antisymmetry is a theorem, not an axiom: it + follows from irreflexivity and transitivity.

    + +

    [3] Because of irreflexivity and transitivity, + operator< always satisfies the definition of a partial + ordering. The definition of a strict weak ordering is stricter, + and the definition of a total ordering is stricter still.

    + +

    See also

    + +

    EqualityComparable, + StrictWeakOrdering
    +

    +
    + +

    Valid HTML 4.01 Transitional

    + +

    Revised + 05 + December, 2006

    + + + + + + + +
    Copyright © 2000Jeremy Siek, Univ.of + Notre Dame (jsiek@lsc.nd.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)

    + + diff --git a/MultiPassInputIterator.html b/MultiPassInputIterator.html index dec6e31..fa7517c 100644 --- a/MultiPassInputIterator.html +++ b/MultiPassInputIterator.html @@ -1,92 +1,95 @@ - - - -MultiPassInputIterator - -C++ Boost + -
    + + + + -

    - -Multi-Pass Input Iterator -

    + MultiPassInputIterator + -This concept is a refinement of Input Iterator, -adding the requirements that the iterator can be used to make multiple -passes through a range, and that if it1 == it2 and -it1 is dereferenceable then ++it1 == ++it2. The -Multi-Pass Input Iterator is very similar to the Forward Iterator. The -only difference is that a Forward Iterator -requires the reference type to be value_type&, whereas -MultiPassInputIterator is like Input Iterator -in that the reference type merely has to be convertible to -value_type. + + C++ Boost
    +

    Multi-Pass Input Iterator

    -

    Design Notes

    +

    This concept is a refinement of Input Iterator, adding + the requirements that the iterator can be used to make multiple passes + through a range, and that if it1 == it2 and it1 is + dereferenceable then ++it1 == ++it2. The Multi-Pass Input Iterator + is very similar to the Forward Iterator. + The only difference is that a Forward Iterator + requires the reference type to be value_type&, + whereas MultiPassInputIterator is like Input Iterator in that + the reference type merely has to be convertible to + value_type.

    -comments by Valentin Bonnard: +

    Design Notes

    -

    I think that introducing Multi-Pass Input Iterator isn't the right -solution. Do you also want to define Multi-Pass Bidirectionnal Iterator -and Multi-Pass Random Access Iterator ? I don't, definitly. It only -confuses the issue. The problem lies into the existing hierarchy of -iterators, which mixes movabillity, modifiabillity and lvalue-ness, -and these are clearly independant. +

    comments by Valentin Bonnard:

    -

    The terms Forward, Bidirectionnal and Random Access are about -movabillity and shouldn't be used to mean anything else. In a -completly orthogonal way, iterators can be immutable, mutable, or -neither. Lvalueness of iterators is also orthogonal with -immutabillity. With these clean concepts, your Multi-Pass Input Iterator -is just called a Forward Iterator. +

    I think that introducing Multi-Pass Input Iterator isn't the right + solution. Do you also want to define Multi-Pass Bidirectionnal Iterator and + Multi-Pass Random Access Iterator ? I don't, definitly. It only confuses + the issue. The problem lies into the existing hierarchy of iterators, which + mixes movabillity, modifiabillity and lvalue-ness, and these are clearly + independant.

    -

    -Other translations are:
    -std::Forward Iterator -> ForwardIterator & Lvalue Iterator
    -std::Bidirectionnal Iterator -> Bidirectionnal Iterator & Lvalue Iterator
    -std::Random Access Iterator -> Random Access Iterator & Lvalue Iterator
    +

    The terms Forward, Bidirectionnal and Random Access are about + movabillity and shouldn't be used to mean anything else. In a completly + orthogonal way, iterators can be immutable, mutable, or neither. Lvalueness + of iterators is also orthogonal with immutabillity. With these clean + concepts, your Multi-Pass Input Iterator is just called a Forward + Iterator.

    -

    -Note that in practice the only operation not allowed on my -Forward Iterator which is allowed on std::Forward Iterator is -&*it. I think that &* is rarely needed in generic code. +

    Other translations are:
    + std::Forward Iterator -> ForwardIterator & Lvalue Iterator
    + std::Bidirectionnal Iterator -> Bidirectionnal Iterator & Lvalue + Iterator
    + std::Random Access Iterator -> Random Access Iterator & Lvalue + Iterator

    -

    -reply by Jeremy Siek: +

    Note that in practice the only operation not allowed on my Forward + Iterator which is allowed on std::Forward Iterator is &*it. I + think that &* is rarely needed in generic code.

    -

    -The above analysis by Valentin is right on. Of course, there is -the problem with backward compatibility. The current STL implementations -are based on the old definition of Forward Iterator. The right course -of action is to get Forward Iterator, etc. changed in the C++ standard. -Once that is done we can drop Multi-Pass Input Iterator. +

    reply by Jeremy Siek:

    +

    The above analysis by Valentin is right on. Of course, there is the + problem with backward compatibility. The current STL implementations are + based on the old definition of Forward Iterator. The right course of action + is to get Forward Iterator, etc. changed in the C++ standard. Once that is + done we can drop Multi-Pass Input Iterator.

    +
    -
    -
    - - -
    Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) -
    +

    Valid HTML 4.01 Transitional

    - - +

    Revised + 05 + December, 2006

    + + + + + + + +
    Copyright © 2000Jeremy Siek, Univ.of + Notre Dame (jsiek@lsc.nd.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)

    + + diff --git a/generator_iterator.htm b/generator_iterator.htm index fd3e3fc..c81d3d1 100644 --- a/generator_iterator.htm +++ b/generator_iterator.htm @@ -1,33 +1,37 @@ - + -Generator Iterator Adaptor Documentation + + + + Generator Iterator Adaptor Documentation - -boost.png (6897 bytes) + boost.png (6897 bytes) -

    Generator Iterator Adaptor

    -Defined in header boost/generator_iterator.hpp -

    -The generator iterator adaptor makes it easier to create custom input -iterators from 0-ary functions and function objects. The adaptor -takes a -Generator -and creates a model of -Input Iterator. -Each increment retrieves an item from the generator and makes it -available to be retrieved by dereferencing. The motivation for this -iterator is that some concepts can be more naturally expressed as a -generator, while most STL algorithms expect an iterator. An example -is the Random Number library. +

    Generator Iterator Adaptor

    -

    Synopsis

    +

    Defined in header boost/generator_iterator.hpp

    -
    -
    +  

    The generator iterator adaptor makes it easier to create custom input + iterators from 0-ary functions and function objects. The adaptor takes a + Generator and + creates a model of Input Iterator. Each + increment retrieves an item from the generator and makes it available to be + retrieved by dereferencing. The motivation for this iterator is that some + concepts can be more naturally expressed as a generator, while most STL + algorithms expect an iterator. An example is the Random Number library.

    + +

    Synopsis

    + +
    +
     namespace boost {
       template <class Generator>
       class generator_iterator_policies;
    @@ -40,21 +44,19 @@ namespace boost {
       make_generator_iterator(Generator & gen);
     }
     
    -
    +
    +
    -
    +

    The Generator Iterator Generator Class

    -

    The Generator Iterator Generator Class

    - -The class generator_iterator_generator is a helper class whose purpose -is to construct a generator iterator type. The template parameter for -this class is the Generator function object type that is being -wrapped. The generator iterator adaptor only holds a reference (or -pointer) to the function object, therefore the function object must -outlive the generator iterator adaptor constructed from it. - -
    -template <class Generator>
    +  

    The class generator_iterator_generator is a helper class whose purpose + is to construct a generator iterator type. The template parameter for this + class is the Generator function object type that is being wrapped. The + generator iterator adaptor only holds a reference (or pointer) to the + function object, therefore the function object must outlive the generator + iterator adaptor constructed from it.

    +
    +template <class Generator>
     class generator_iterator_generator
     {
     public:
    @@ -62,65 +64,65 @@ public:
     }
     
    +

    Template Parameters

    -

    Template Parameters

    + + + -
    Parameter
    - - - - + + - - -
    ParameterDescription
    Description
    Generator -The generator (0-ary function object) type being -wrapped. The return type of the function must be defined as -Generator::result_type. The function object must be a model -of -Generator. -
    + + Generator -

    Concept Model

    -The generator iterator class is a model of -Input Iterator. + The generator (0-ary function object) type being wrapped. The + return type of the function must be defined as + Generator::result_type. The function object must be a model of + Generator. + + -

    Members

    -The generator iterator implements the member functions -and operators required of the -Input Iterator -concept. +

    Concept Model

    -
    +

    The generator iterator class is a model of Input Iterator.

    -
    -

    The Generator Iterator Object Generator

    +

    Members

    -The make_generator_iterator() function provides a -convenient way to create generator iterator objects. The function -saves the user the trouble of explicitly writing out the iterator -types. +

    The generator iterator implements the member functions and operators + required of the Input Iterator + concept.

    +
    -
    -
    +  

    The + Generator Iterator Object Generator

    + +

    The make_generator_iterator() function provides a convenient + way to create generator iterator objects. The function saves the user the + trouble of explicitly writing out the iterator types.

    + +
    +
     template <class Generator>
     typename generator_iterator_generator<Generator>::type
     make_generator_iterator(Generator & gen);
     
    -
    +
    +
    -
    +

    Example

    +

    The following program shows how generator_iterator + transforms a generator into an input iterator.

    -

    Example

    - -The following program shows how generator_iterator -transforms a generator into an input iterator. - -
    -
    -#include <iostream>
    -#include <boost/generator_iterator.hpp>
    +  
    +
    +#include <iostream>
    +#include <boost/generator_iterator.hpp>
     
     class my_generator
     {
    @@ -140,11 +142,22 @@ int main()
         std::cout << *it << std::endl;
     }
     
    -
    +
    +
    -
    +

    Valid HTML 4.01 Transitional

    -Written by Jens Maurer. +

    Revised + 05 December, 2006

    +

    Copyright © 2001 Jens Maurer

    + +

    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)

    From 005c2f3cc8b3cbef266c0d30f8512f338a662ef5 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 7 Jan 2007 22:58:41 +0000 Subject: [PATCH 11/34] Fix a couple of links. [SVN r36656] --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 1d2bffb..b08822b 100644 --- a/index.html +++ b/index.html @@ -30,11 +30,11 @@

    © Copyright Beman Dawes, 2001

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file + accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

    Revised 07 November, 2006

    - \ No newline at end of file + From aa0096bf42209c92261d0ae11d1460c7ced06c4a Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Thu, 12 Apr 2007 14:32:38 +0000 Subject: [PATCH 12/34] Testsuite for none_t added. [SVN r37421] --- test/Jamfile.v2 | 1 + test/none_test.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/none_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d5ecaa0..330c08c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -33,4 +33,5 @@ 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 ] ; diff --git a/test/none_test.cpp b/test/none_test.cpp new file mode 100644 index 0000000..00a6fc9 --- /dev/null +++ b/test/none_test.cpp @@ -0,0 +1,22 @@ +// 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 ); +} From d5ea07c737bf0c1a33325f71bca0534470558553 Mon Sep 17 00:00:00 2001 From: Daniel Frey Date: Wed, 6 Jun 2007 20:57:40 +0000 Subject: [PATCH 13/34] Merged changes for ticket #979 from HEAD [SVN r37920] --- include/boost/operators.hpp | 204 ++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 101 deletions(-) diff --git a/include/boost/operators.hpp b/include/boost/operators.hpp index fbba602..b3b1bd7 100644 --- a/include/boost/operators.hpp +++ b/include/boost/operators.hpp @@ -8,6 +8,8 @@ // See http://www.boost.org/libs/utility/operators.htm for documentation. // Revision History +// 24 May 07 Changed empty_base to depend on T, see +// http://svn.boost.org/trac/boost/ticket/979 // 21 Oct 02 Modified implementation of operators to allow compilers with a // correct named return value optimization (NRVO) to produce optimal // code. (Daniel Frey) @@ -90,15 +92,15 @@ namespace boost { namespace detail { +template class empty_base { + // Helmut Zeisel, empty base class optimization bug with GCC 3.0.0 #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0 -class empty_base { bool dummy; -}; -#else -class empty_base {}; #endif +}; + } // namespace detail } // namespace boost @@ -119,7 +121,7 @@ namespace boost // Note that friend functions defined in a class are implicitly inline. // See the C++ std, 11.4 [class.friend] paragraph 5 -template +template > struct less_than_comparable2 : B { friend bool operator<=(const T& x, const U& y) { return !(x > y); } @@ -130,7 +132,7 @@ struct less_than_comparable2 : B friend bool operator>=(const U& x, const T& y) { return !(y > x); } }; -template +template > struct less_than_comparable1 : B { friend bool operator>(const T& x, const T& y) { return y < x; } @@ -138,7 +140,7 @@ struct less_than_comparable1 : B friend bool operator>=(const T& x, const T& y) { return !(x < y); } }; -template +template > struct equality_comparable2 : B { friend bool operator==(const U& y, const T& x) { return x == y; } @@ -146,7 +148,7 @@ struct equality_comparable2 : B friend bool operator!=(const T& y, const U& x) { return !(y == x); } }; -template +template > struct equality_comparable1 : B { friend bool operator!=(const T& x, const T& y) { return !(x == y); } @@ -165,7 +167,7 @@ struct equality_comparable1 : B // implementation available. #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template \ +template > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ @@ -174,33 +176,33 @@ struct NAME##2 : B \ { T nrv( rhs ); nrv OP##= lhs; return nrv; } \ }; \ \ -template \ +template > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; -#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template \ -struct NAME##2 : B \ -{ \ - friend T operator OP( const T& lhs, const U& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template \ -struct BOOST_OPERATOR2_LEFT(NAME) : B \ -{ \ - friend T operator OP( const U& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template \ -struct NAME##1 : B \ -{ \ - friend T operator OP( const T& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ +template > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( const T& lhs, const U& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template > \ +struct BOOST_OPERATOR2_LEFT(NAME) : B \ +{ \ + friend T operator OP( const U& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( const T& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) @@ -210,35 +212,35 @@ struct NAME##1 : B \ // BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide // optimization opportunities to the compiler :) -#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template \ -struct NAME##2 : B \ -{ \ - friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ - friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ -}; \ - \ -template \ -struct NAME##1 : B \ -{ \ - friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ +#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ +template > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ + friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ +}; \ + \ +template > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ }; #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template \ +template > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template \ +template > \ struct BOOST_OPERATOR2_LEFT(NAME) : B \ { \ friend T operator OP( const U& lhs, const T& rhs ) \ { return T( lhs ) OP##= rhs; } \ }; \ \ -template \ +template > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ @@ -261,7 +263,7 @@ BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | ) // incrementable and decrementable contributed by Jeremy Siek -template +template > struct incrementable : B { friend T operator++(T& x, int) @@ -274,7 +276,7 @@ private: // The use of this typedef works around a Borland bug typedef T incrementable_type; }; -template +template > struct decrementable : B { friend T operator--(T& x, int) @@ -289,7 +291,7 @@ private: // The use of this typedef works around a Borland bug // Iterator operator classes (contributed by Jeremy Siek) ------------------// -template +template > struct dereferenceable : B { P operator->() const @@ -298,7 +300,7 @@ struct dereferenceable : B } }; -template +template > struct indexable : B { R operator[](I n) const @@ -313,14 +315,14 @@ struct indexable : B #if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template \ +template > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; \ \ -template \ +template > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ @@ -330,13 +332,13 @@ struct NAME##1 : B \ #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template \ +template > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template \ +template > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ @@ -349,7 +351,7 @@ BOOST_BINARY_OPERATOR( right_shiftable, >> ) #undef BOOST_BINARY_OPERATOR -template +template > struct equivalent2 : B { friend bool operator==(const T& x, const U& y) @@ -358,7 +360,7 @@ struct equivalent2 : B } }; -template +template > struct equivalent1 : B { friend bool operator==(const T&x, const T&y) @@ -367,7 +369,7 @@ struct equivalent1 : B } }; -template +template > struct partially_ordered2 : B { friend bool operator<=(const T& x, const U& y) @@ -384,7 +386,7 @@ struct partially_ordered2 : B { return (y < x) || (y == x); } }; -template +template > struct partially_ordered1 : B { friend bool operator>(const T& x, const T& y) @@ -397,161 +399,161 @@ struct partially_ordered1 : B // Combined operator classes (contributed by Daryle Walker) ----------------// -template +template > struct totally_ordered2 : less_than_comparable2 > {}; -template +template > struct totally_ordered1 : less_than_comparable1 > {}; -template +template > struct additive2 : addable2 > {}; -template +template > struct additive1 : addable1 > {}; -template +template > struct multiplicative2 : multipliable2 > {}; -template +template > struct multiplicative1 : multipliable1 > {}; -template +template > struct integer_multiplicative2 : multiplicative2 > {}; -template +template > struct integer_multiplicative1 : multiplicative1 > {}; -template +template > struct arithmetic2 : additive2 > {}; -template +template > struct arithmetic1 : additive1 > {}; -template +template > struct integer_arithmetic2 : additive2 > {}; -template +template > struct integer_arithmetic1 : additive1 > {}; -template +template > struct bitwise2 : xorable2 > > {}; -template +template > struct bitwise1 : xorable1 > > {}; -template +template > struct unit_steppable : incrementable > {}; -template +template > struct shiftable2 : left_shiftable2 > {}; -template +template > struct shiftable1 : left_shiftable1 > {}; -template +template > struct ring_operators2 : additive2 > > {}; -template +template > struct ring_operators1 : additive1 > {}; -template +template > struct ordered_ring_operators2 : ring_operators2 > {}; -template +template > struct ordered_ring_operators1 : ring_operators1 > {}; -template +template > struct field_operators2 : ring_operators2 > > {}; -template +template > struct field_operators1 : ring_operators1 > {}; -template +template > struct ordered_field_operators2 : field_operators2 > {}; -template +template > struct ordered_field_operators1 : field_operators1 > {}; -template +template > struct euclidian_ring_operators2 : ring_operators2 > > > > {}; -template +template > struct euclidian_ring_operators1 : ring_operators1 > > {}; -template +template > struct ordered_euclidian_ring_operators2 : totally_ordered2 > {}; -template +template > struct ordered_euclidian_ring_operators1 : totally_ordered1 > {}; -template +template > struct input_iteratable : equality_comparable1 > > {}; -template +template > struct output_iteratable : incrementable {}; -template +template > struct forward_iteratable : input_iteratable {}; -template +template > struct bidirectional_iteratable : forward_iteratable +template > struct random_access_iteratable : bidirectional_iteratable \ +# define BOOST_IMPORT_TEMPLATE4(template_name) \ + template > \ struct template_name : ::template_name {}; -# define BOOST_IMPORT_TEMPLATE3(template_name) \ - template \ +# define BOOST_IMPORT_TEMPLATE3(template_name) \ + template > \ struct template_name : ::template_name {}; -# define BOOST_IMPORT_TEMPLATE2(template_name) \ - template \ +# define BOOST_IMPORT_TEMPLATE2(template_name) \ + template > \ struct template_name : ::template_name {}; -# define BOOST_IMPORT_TEMPLATE1(template_name) \ - template \ +# define BOOST_IMPORT_TEMPLATE1(template_name) \ + template > \ struct template_name : ::template_name {}; # endif // BOOST_NO_USING_TEMPLATE @@ -752,7 +754,7 @@ template struct is_chained_base { # define BOOST_OPERATOR_TEMPLATE(template_name) \ template \ ,class O = typename is_chained_base::value \ > \ struct template_name : template_name##2 {}; \ @@ -788,7 +790,7 @@ BOOST_OPERATOR_TEMPLATE1(template_name##1) // In this case we can only assume that template_name<> is equivalent to the // more commonly needed template_name1<> form. # define BOOST_OPERATOR_TEMPLATE(template_name) \ - template \ + template > \ struct template_name : template_name##1 {}; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION From 9ff18c2c96cf2d14ff5bb5723413e5121e3d6dd7 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 24 Jul 2007 19:28:14 +0000 Subject: [PATCH 14/34] This commit was manufactured by cvs2svn to create tag 'Version_1_34_1'. [SVN r38286] From 6aa648d3157c6d274509ea90a4562d72fa4e81e8 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Fri, 5 Oct 2007 14:25:06 +0000 Subject: [PATCH 15/34] Starting point for releases [SVN r39706] From 74462349c284e9a5785c3594f6509ada480e3b5b Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:07:19 +0000 Subject: [PATCH 16/34] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41369] --- include/boost/assert.hpp | 13 +++ include/boost/current_function.hpp | 4 + .../detail/in_place_factory_prefix.hpp | 19 +-- .../detail/in_place_factory_suffix.hpp | 8 +- .../utility/detail/result_of_iterate.hpp | 31 ++--- include/boost/utility/in_place_factory.hpp | 96 ++++++++++------ include/boost/utility/result_of.hpp | 52 ++++++--- .../boost/utility/typed_in_place_factory.hpp | 84 ++++++++------ include/boost/utility/value_init.hpp | 108 +++++++++++++----- 9 files changed, 278 insertions(+), 137 deletions(-) diff --git a/include/boost/assert.hpp b/include/boost/assert.hpp index 5619f29..c227f17 100644 --- a/include/boost/assert.hpp +++ b/include/boost/assert.hpp @@ -2,6 +2,7 @@ // boost/assert.hpp - BOOST_ASSERT(expr) // // Copyright (c) 2001, 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 @@ -35,3 +36,15 @@ void assertion_failed(char const * expr, char const * function, char const * fil # include // .h to support old libraries w/o - effect is the same # define BOOST_ASSERT(expr) assert(expr) #endif + +#undef BOOST_VERIFY + +#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) ) + +# define BOOST_VERIFY(expr) ((void)(expr)) + +#else + +# define BOOST_VERIFY(expr) BOOST_ASSERT(expr) + +#endif diff --git a/include/boost/current_function.hpp b/include/boost/current_function.hpp index 40e3abd..aa5756e 100644 --- a/include/boost/current_function.hpp +++ b/include/boost/current_function.hpp @@ -32,6 +32,10 @@ inline void current_function_helper() # define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__DMC__) && (__DMC__ >= 0x810) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + #elif defined(__FUNCSIG__) # define BOOST_CURRENT_FUNCTION __FUNCSIG__ diff --git a/include/boost/utility/detail/in_place_factory_prefix.hpp b/include/boost/utility/detail/in_place_factory_prefix.hpp index 092083e..6ce7247 100644 --- a/include/boost/utility/detail/in_place_factory_prefix.hpp +++ b/include/boost/utility/detail/in_place_factory_prefix.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,25 +10,27 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP -#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP +#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP +#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP +#include +#include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT(z,n,_) BOOST_PP_CAT(m_a,n) BOOST_PP_LPAREN() BOOST_PP_CAT(a,n) BOOST_PP_RPAREN() #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL(z,n,_) BOOST_PP_CAT(A,n) const& BOOST_PP_CAT(m_a,n); -#define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG(z,n,_) BOOST_PP_CAT(m_a,n) #define BOOST_MAX_INPLACE_FACTORY_ARITY 10 -#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP +#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP #endif diff --git a/include/boost/utility/detail/in_place_factory_suffix.hpp b/include/boost/utility/detail/in_place_factory_suffix.hpp index 3efe221..b1fc4d3 100644 --- a/include/boost/utility/detail/in_place_factory_suffix.hpp +++ b/include/boost/utility/detail/in_place_factory_suffix.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,15 +10,14 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP -#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP +#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP +#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL -#undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG #undef BOOST_MAX_INPLACE_FACTORY_ARITY -#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP +#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP #endif diff --git a/include/boost/utility/detail/result_of_iterate.hpp b/include/boost/utility/detail/result_of_iterate.hpp index 5aa3a5c..41616c3 100644 --- a/include/boost/utility/detail/result_of_iterate.hpp +++ b/include/boost/utility/detail/result_of_iterate.hpp @@ -21,66 +21,69 @@ template struct result_of - : detail::result_of {}; + : boost::detail::result_of_impl::value)> {}; #endif +#undef BOOST_RESULT_OF_ARGS + +#if BOOST_PP_ITERATION() >= 1 + namespace detail { template -struct result_of +struct result_of_impl { typedef R type; }; template -struct result_of +struct result_of_impl { typedef R type; }; -#undef BOOST_RESULT_OF_ARGS - -#if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) template -struct result_of + FArgs, false> { typedef R type; }; template -struct result_of + FArgs, false> { typedef R type; }; template -struct result_of + FArgs, false> { typedef R type; }; template -struct result_of + FArgs, false> { typedef R type; }; #endif } +#endif diff --git a/include/boost/utility/in_place_factory.hpp b/include/boost/utility/in_place_factory.hpp index 612c9a3..16eaacf 100644 --- a/include/boost/utility/in_place_factory.hpp +++ b/include/boost/utility/in_place_factory.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,50 +10,79 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP -#define BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP +#ifndef BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP +#ifndef BOOST_PP_IS_ITERATING #include -#include - namespace boost { class in_place_factory_base {} ; -#define BOOST_DEFINE_INPLACE_FACTORY_CLASS(z,n,_) \ -template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -class BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) : public in_place_factory_base \ -{ \ -public: \ -\ - BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ - : \ - BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ - {} \ -\ - template \ - void apply ( void* address BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T) ) const \ - { \ - new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ - } \ -\ - BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ -} ; \ -\ -template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ -in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ -{ \ - return BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ - ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ -} ; \ - -BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY) +#define BOOST_PP_FILENAME_1 +#include BOOST_PP_ITERATE() } // namespace boost #include +#define BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP +#else +#define N BOOST_PP_ITERATION() + +#if N +template< BOOST_PP_ENUM_PARAMS(N, class A) > +#endif +class BOOST_PP_CAT(in_place_factory,N) + : + public in_place_factory_base +{ +public: + + explicit BOOST_PP_CAT(in_place_factory,N) + ( BOOST_PP_ENUM_BINARY_PARAMS(N,A,const& a) ) +#if N > 0 + : BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _) +#endif + {} + + template + void* apply(void* address + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + { + return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) ); + } + + template + void* apply(void* address, std::size_t n + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + { + for(char* next = address = this->BOOST_NESTED_TEMPLATE apply(address); + !! --n;) + this->BOOST_NESTED_TEMPLATE apply(next = next+sizeof(T)); + return address; + } + + BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) +}; + +#if N > 0 +template< BOOST_PP_ENUM_PARAMS(N, class A) > +inline BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) > +in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +{ + return BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) > + ( BOOST_PP_ENUM_PARAMS(N, a) ); +} +#else +inline in_place_factory0 in_place() +{ + return in_place_factory0(); +} +#endif + +#undef N +#endif #endif diff --git a/include/boost/utility/result_of.hpp b/include/boost/utility/result_of.hpp index 668cb69..cdcac34 100644 --- a/include/boost/utility/result_of.hpp +++ b/include/boost/utility/result_of.hpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #ifndef BOOST_RESULT_OF_NUM_ARGS # define BOOST_RESULT_OF_NUM_ARGS 10 @@ -29,28 +31,48 @@ namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) -template struct get_result_of; - -template -struct get_result_of -{ - typedef typename F::result_type type; -}; - -template -struct get_result_of -{ - typedef typename F::template result::type type; -}; +template struct result_of_impl; template -struct get_result_of +struct result_of_void_impl { typedef void type; }; +template +struct result_of_void_impl +{ + typedef R type; +}; + +template +struct result_of_void_impl +{ + typedef R type; +}; + template -struct result_of : get_result_of::value)> {}; +struct result_of_impl +{ + typedef typename F::result_type type; +}; + +template +struct is_function_with_no_args : mpl::false_ {}; + +template +struct is_function_with_no_args : mpl::true_ {}; + +template +struct result_of_nested_result : F::template result +{}; + +template +struct result_of_impl + : mpl::if_, + result_of_void_impl, + result_of_nested_result >::type +{}; } // end namespace detail diff --git a/include/boost/utility/typed_in_place_factory.hpp b/include/boost/utility/typed_in_place_factory.hpp index e19fb75..347b7f4 100644 --- a/include/boost/utility/typed_in_place_factory.hpp +++ b/include/boost/utility/typed_in_place_factory.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,8 +10,8 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP -#define BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP +#ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP +#ifndef BOOST_PP_IS_ITERATING #include @@ -18,40 +19,59 @@ namespace boost { class typed_in_place_factory_base {} ; -#define BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS(z,n,_) \ -template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -class BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) : public typed_in_place_factory_base \ -{ \ -public: \ -\ - typedef T value_type ; \ -\ - BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ - : \ - BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ - {} \ -\ - void apply ( void* address ) const \ - { \ - new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ - } \ -\ - BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ -} ; \ -\ -template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T , BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ -in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ -{ \ - return BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T, BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ - ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ -} ; \ - -BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY) +#define BOOST_PP_FILENAME_1 +#include BOOST_PP_ITERATE() } // namespace boost #include +#define BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP +#else +#define N BOOST_PP_ITERATION() + +template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N,class A) > +class BOOST_PP_CAT(typed_in_place_factory,N) + : + public typed_in_place_factory_base +{ +public: + + typedef T value_type; + + explicit BOOST_PP_CAT(typed_in_place_factory,N) + ( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +#if N > 0 + : BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _) +#endif + {} + + void* apply (void* address) const + { + return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) ); + } + + void* apply (void* address, std::size_t n) const + { + for(void* next = address = this->apply(address); !! --n;) + this->apply(next = static_cast(next) + sizeof(T)); + return address; + } + + BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) +}; + +template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N, class A) > +inline BOOST_PP_CAT(typed_in_place_factory,N)< + T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) > +in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +{ + return BOOST_PP_CAT(typed_in_place_factory,N)< + T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) >( BOOST_PP_ENUM_PARAMS(N, a) ); +} + +#undef N +#endif #endif diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index d24908c..c4cd3e1 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -1,63 +1,110 @@ -// Copyright 2002, Fernando Luis Cacciola Carballal. +// (C) Copyright 2002-2007, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // 21 Ago 2002 (Created) Fernando Cacciola +// 07 Set 2007 (Worked around MSVC++ bug) Fernando Cacciola, Niels Dekker +// 16 Nov 2007 (Refactoring: removed private base classes) Fernando Cacciola, Niels Dekker // #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP -#include "boost/detail/select_type.hpp" -#include "boost/type_traits/cv_traits.hpp" +#include +#include +#include + +// Microsoft Visual C++ does not correctly support value initialization, as reported by +// Pavel Kuznetsov (MetaCommunications Engineering), 7/28/2005, Feedback ID 100744, +// Feedback Title: Value-initialization in new-expression +// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 +// The report was closed at 11/14/2006, and its status was set to "Closed (Won't Fix)". +// Luckily, even in the presence of this compiler bug, boost::value_initialized will still +// do its job correctly, when using the following workaround: +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) +# define BOOST_UTILITY_VALUE_INIT_WORKAROUND +#endif + +#ifdef BOOST_UTILITY_VALUE_INIT_WORKAROUND + +#include +#include +#include +#include + +#ifdef BOOST_MSVC +#pragma warning(push) +#if _MSC_VER >= 1310 +// When using MSVC 7.1 or higher, placement new, "new (&x) T()", may trigger warning C4345: +// "behavior change: an object of POD type constructed with an initializer of the form () +// will be default-initialized". There is no need to worry about this, though. +#pragma warning(disable: 4345) +#endif +#endif namespace boost { -namespace vinit_detail { - template -class const_T_base +class value_initialized { - protected : + private : + mutable typename ::boost::aligned_storage::value>::type x; - const_T_base() : x() {} + public : + + value_initialized() + { + std::memset(&x, 0, sizeof(x)); + new (&x) T(); + } + + ~value_initialized() + { + void * ptr = &x; + static_cast(ptr)->T::~T(); + } + + T& data() const + { + void * ptr = &x; + return *static_cast(ptr); + } + + operator T&() const { return this->data(); } - T x ; } ; -template -struct non_const_T_base -{ - protected : +#ifdef BOOST_MSVC +// Restores the state of warning C4345. +#pragma warning(pop) +#endif - non_const_T_base() : x() {} +#else - mutable T x ; -} ; +namespace boost { template -struct select_base -{ - typedef typename - boost::detail::if_true< ::boost::is_const::value > - ::template then< const_T_base, non_const_T_base >::type type ; -} ; - -} // namespace vinit_detail - -template -class value_initialized : private vinit_detail::select_base::type +class value_initialized { public : - value_initialized() {} + value_initialized() : x() {} - operator T&() const { return this->x ; } + T& data() const { return x; } - T& data() const { return this->x ; } + operator T&() const { return this->data(); } + + mutable +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + typename +#endif + ::boost::remove_const::type x ; } ; +#endif + + template T const& get ( value_initialized const& x ) @@ -74,4 +121,3 @@ T& get ( value_initialized& x ) #endif - From 13bdfb8bbdd4ad60da171050bf83e4c9eec7d57d Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:38:02 +0000 Subject: [PATCH 17/34] 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 From d5554eb6d74232368c0815888e38c67f16ce936b Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 22:34:55 +0000 Subject: [PATCH 18/34] Pick up missing smart_ptr, utility, and type_traits files from full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41386] --- verify_test.cpp | 126 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 verify_test.cpp diff --git a/verify_test.cpp b/verify_test.cpp new file mode 100644 index 0000000..3481636 --- /dev/null +++ b/verify_test.cpp @@ -0,0 +1,126 @@ +// +// 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 + +#include + +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 + +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 +#include +#include + +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(); +} From 88099a882f805dd4294d963fd995b6d158dfe7df Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sat, 5 Jan 2008 22:38:50 +0000 Subject: [PATCH 19/34] Merged value_init.hpp from trunk [42277] to release branch, thereby resolving ticket #1459 and #1491. Fernando Cacciola (owner of value_init) encouraged me to do the commit. [SVN r42501] --- include/boost/utility/value_init.hpp | 119 +++++++++++++-------------- 1 file changed, 56 insertions(+), 63 deletions(-) diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index c4cd3e1..097f21a 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -5,105 +5,98 @@ // http://www.boost.org/LICENSE_1_0.txt) // // 21 Ago 2002 (Created) Fernando Cacciola -// 07 Set 2007 (Worked around MSVC++ bug) Fernando Cacciola, Niels Dekker -// 16 Nov 2007 (Refactoring: removed private base classes) Fernando Cacciola, Niels Dekker +// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker // #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP -#include -#include -#include - -// Microsoft Visual C++ does not correctly support value initialization, as reported by -// Pavel Kuznetsov (MetaCommunications Engineering), 7/28/2005, Feedback ID 100744, -// Feedback Title: Value-initialization in new-expression +// Note: The implementation of boost::value_initialized had to deal with the +// fact that various compilers haven't fully implemented value-initialization: +// Microsoft Feedback ID 100744 - Value-initialization in new-expression +// Reported by Pavel Kuznetsov (MetaCommunications Engineering), 2005-07-28 // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 -// The report was closed at 11/14/2006, and its status was set to "Closed (Won't Fix)". -// Luckily, even in the presence of this compiler bug, boost::value_initialized will still -// do its job correctly, when using the following workaround: -#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) -# define BOOST_UTILITY_VALUE_INIT_WORKAROUND -#endif - -#ifdef BOOST_UTILITY_VALUE_INIT_WORKAROUND +// GCC Bug 30111 - Value-initialization of POD base class doesn't initialize members +// Reported by Jonathan Wakely, 2006-12-07 +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 +// GCC Bug 33916 - Default constructor fails to initialize array members +// Reported by Michael Elizabeth Chastain, 2007-10-26 +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 +// Borland Report 51854 - Value-initialization: POD struct should be zero-initialized +// Reported by Niels Dekker (LKEB, Leiden University Medical Center), 2007-11-09 +// http://qc.codegear.com/wc/qcmain.aspx?d=51854 +// The constructor of boost::value_initialized works around these issues, by +// clearing the bytes of T, before constructing the T object it contains. #include +#include +#include #include #include #include -#ifdef BOOST_MSVC -#pragma warning(push) -#if _MSC_VER >= 1310 -// When using MSVC 7.1 or higher, placement new, "new (&x) T()", may trigger warning C4345: -// "behavior change: an object of POD type constructed with an initializer of the form () -// will be default-initialized". There is no need to worry about this, though. -#pragma warning(disable: 4345) -#endif -#endif - namespace boost { template class value_initialized { private : - mutable typename ::boost::aligned_storage::value>::type x; + struct wrapper + { +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + typename +#endif + remove_const::type data; + }; + + mutable aligned_storage::value> x; public : value_initialized() { - std::memset(&x, 0, sizeof(x)); - new (&x) T(); + std::memset(x.address(), 0, sizeof(x)); +#ifdef BOOST_MSVC +#pragma warning(push) +#if _MSC_VER >= 1310 +// When using MSVC 7.1 or higher, the following placement new expression may trigger warning C4345: +// "behavior change: an object of POD type constructed with an initializer of the form () +// will be default-initialized". There is no need to worry about this, though. +#pragma warning(disable: 4345) +#endif +#endif + new (x.address()) wrapper(); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + + value_initialized(value_initialized const & arg) + { + new (x.address()) wrapper( *static_cast(arg.x.address()) ); + } + + value_initialized & operator=(value_initialized const & arg) + { + T & this_data = this->data(); + T const & arg_data = arg.data(); + this_data = arg_data; + return *this; } ~value_initialized() { - void * ptr = &x; - static_cast(ptr)->T::~T(); + static_cast(x.address())->wrapper::~wrapper(); } T& data() const { - void * ptr = &x; - return *static_cast(ptr); + return static_cast(x.address())->data; } operator T&() const { return this->data(); } } ; -#ifdef BOOST_MSVC -// Restores the state of warning C4345. -#pragma warning(pop) -#endif - -#else - -namespace boost { - -template -class value_initialized -{ - public : - - value_initialized() : x() {} - - T& data() const { return x; } - - operator T&() const { return this->data(); } - - mutable -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - typename -#endif - ::boost::remove_const::type x ; - -} ; -#endif - template From 97b8966337057eb02b8a8da355b6082a5f760d51 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 15 Jan 2008 19:55:28 +0000 Subject: [PATCH 20/34] value_init doc + test: Merged from trunk changeset [42798] to release. [SVN r42799] --- value_init.htm | 165 ++++++++++++++++++++++++++++++++++++------ value_init_test.cpp | 173 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 310 insertions(+), 28 deletions(-) diff --git a/value_init.htm b/value_init.htm index 8ceba8b..405f0b6 100644 --- a/value_init.htm +++ b/value_init.htm @@ -17,11 +17,13 @@
    Rationale
    Introduction
    +
    Details
    @@ -30,7 +32,7 @@ Acknowledgements
    @@ -44,24 +46,91 @@ for initialization. Depending on the type, the value of a newly constructed object can be zero-initialized (logically 0), default-constructed (using the default constructor), or indeterminate. When writing generic code, -this problem must be addressed. value_initialized provides +this problem must be addressed. The template value_initialized provides a solution with consistent syntax for value initialization of scalar, -union and class types.
    +union and class types. +Moreover, value_initialized offers a workaround to various +compiler issues regarding value-initialization. + +

    Introduction

    -

    The C++ standard [1] contains the definitions +

    +There are various ways to initialize a variable, in C++. The following +declarations all may have a local variable initialized to its default +value: +

    +  T1 var1;
    +  T2 var2 = 0;
    +  T3 var3 = {};
    +  T4 var4 = T4();
    +
    +Unfortunately, whether or not any of those declarations correctly +initialize the variable very much depends on its type. The first +declaration is valid for any +DefaultConstructible type (by definition). +However, it does not always do an initialization! +It correctly initializes the variable when it's an instance of a +class, and the author of the class has provided a proper default +constructor. On the other hand, the value of var1 is indeterminate when +its type is an arithmetic type, like int, float, or char. +An arithmetic variable +is of course initialized properly by the second declaration, T2 +var2 = 0. But this initialization form usually won't work for a +class type (unless the class was especially written to support being +initialized that way). The third form, T3 var3 = {} +initializes an aggregate, typically a "C-style" struct or a "C-style" array. +However, the syntax is not allowed for a class that has an explicitly declared +constructor. (But watch out for an upcoming C++ language change, +by Bjarne Stroustrup et al [1]!) +The fourth form is the most generic form of them, as it +can be used to initialize arithmetic types, class types, aggregates, pointers, and +other types. The declaration, T4 var4 = T4(), should be read +as follows: First a temporary object is created, by T4(). +This object is value-initialized. Next the temporary +object is copied to the named variable, var4. Afterwards, the temporary +is destroyed. While the copying and the destruction are likely to +be optimized away, C++ still requires the type T4 to be +CopyConstructible. +(So T4 needs to be both DefaultConstructible and CopyConstructible.) +A class may not be CopyConstructible, for example because it may have a +private and undefined copy constructor, +or because it may be derived from boost::noncopyable. +Scott Meyers [2] explains why a class would be defined like that. +

    +

    +There is another, less obvious disadvantage to the fourth form, T4 var4 = T4(): +It suffers from various compiler issues, causing +a variable to be left uninitialized in some compiler specific cases. +

    +

    +The template value_initialized +offers a generic way to initialize +an object, like T4 var4 = T4(), but without requiring its type +to be CopyConstructible. And it offers a workaround to those compiler issues +regarding value-initialization as well! It allows getting an initialized +variable of any type; it only requires the type to be DefaultConstructible. +A properly value-initialized object of type T is +constructed by the following declaration: +

    +  value_initialized<T> var;
    +
    +

    + +

    Details

    +

    The C++ standard [3] contains the definitions of zero-initialization and default-initialization. Informally, zero-initialization means that the object is given the initial value 0 (converted to the type) and default-initialization means that - POD [2] types are zero-initialized, while class + POD [4] types are zero-initialized, while non-POD class types are initialized with their corresponding default constructors. A declaration can contain an initializer, which specifies the object's initial value. The initializer can be just '()', which states that -the object shall be default-initialized (but see below). However, if a declaration +the object shall be value-initialized (but see below). However, if a declaration has no initializer and it is of a non-const, non-static - POD type, the initial value is indeterminate:(see §8.5 for the + POD type, the initial value is indeterminate: (see §8.5, [dcl.init], for the accurate definitions).

    int x ; // no initializer. x value is indeterminate.
    std::string s ; // no initializer, s is default-constructed.

    int y = int() ;
    // y is initialized using copy-initialization
    // but the temporary uses an empty set of parentheses as the initializer,
    // so it is default-constructed.
    // A default constructed POD type is zero-initialized,
    // therefore, y == 0.

    void foo ( std::string ) ;
    foo ( std::string() ) ;
    // the temporary string is default constructed
    // as indicated by the initializer ()
    @@ -87,14 +156,11 @@ the object shall be default-initialized (but see below). However, if a decla

    In order to specify value-initialization of an object we need to use the empty-set initializer: ().

    -

    (but recall that the current C++ Standard states that '()' invokes default-initialization, -not value-initialization)

    -

    As before, a declaration with no intializer specifies default-initialization, and a declaration with a non-empty initializer specifies copy (=xxx) or direct (xxx) initialization.

    -
    template<class T> void eat(T);
    int x ; // indeterminate initial value.
    std::string s; // default-initialized.
    eat ( int() ) ; // value-initialized
    eat ( std::string() ) ; // value-initialied
    +
    template<class T> void eat(T);
    int x ; // indeterminate initial value.
    std::string s; // default-initialized.
    eat ( int() ) ; // value-initialized
    eat ( std::string() ) ; // value-initialized

    value-initialization syntax

    @@ -102,7 +168,7 @@ not value-initialization)

    parentheses is not permitted by the syntax of initializers because it is parsed as the declaration of a function taking no arguments:

    -
    int x() ; // declares function int(*)()
    int y ( int() ) ; // decalares function int(*)( int(*)() )
    +
    int x() ; // declares function int(*)()

    Thus, the empty () must be put in some other initialization context.

    @@ -124,8 +190,50 @@ data member:

    template<class T> 
    struct W
    {
    // value-initialization of 'data' here.
    W() : data() {}
    T data ;
    } ;
    W<int> w ;
    // w.data is value-initialized for any type.
    -

    This is the solution supplied by the value_initialized<> template - class.

    +

    This is the solution as it was supplied by earlier versions of the +value_initialized<T> template + class. Unfortunately this approach suffered from various compiler issues.

    + +

    compiler issues

    + +Various compilers haven't yet fully implemented value-initialization. +So when an object should be value-initialized (according to the C++ Standard), +it may in practice still be left uninitialized, because of those +compiler issues! It's hard to make a general statement on what those issues +are like, because they depend on the compiler you are using, its version number, +and the type of object you would like to have value-initialized. +Compilers usually support value-initialization for built-in types properly. +But objects of user-defined types that involve aggregates may in some cases +be partially, or even entirely left uninitialized, when they should be value-initialized. +

    +

    +We have encountered issues regarding value-initialization on compilers by +Microsoft, Sun, Borland, and GNU. Here is a list of bug reports on those issues: + +
    + +Microsoft Feedback ID 100744 - Value-initialization in new-expression +
    Reported by Pavel Kuznetsov (MetaCommunications Engineering), 2005-07-28 +
    + +GCC Bug 30111 - Value-initialization of POD base class doesn't initialize members +
    Reported by Jonathan Wakely, 2006-12-07 +
    + +GCC Bug 33916 - Default constructor fails to initialize array members +
    Reported by Michael Elizabeth Chastain, 2007-10-26 +
    + +Borland Report 51854 - Value-initialization: POD struct should be zero-initialized +
    Reported by Niels Dekker (LKEB, Leiden University Medical Center), 2007-09-11 +
    +
    +

    +New versions of value_initialized +(Boost release version 1.35 or higher) +offer a workaround to these issues: value_initialized will now clear +its internal data, prior to constructing the object that it contains. +

    Types

    @@ -191,23 +299,36 @@ the wrapped object is always performed with the get() idiom:

    value_initialized<int> x ;
    get(x) = 1 ; // OK

    value_initialized<int const> cx ;
    get(x) = 1 ; // ERROR: Cannot modify a const object

    value_initialized<int> const x_c ;
    get(x_c) = 1 ; // ERROR: Cannot modify a const object

    value_initialized<int const> const cx_c ;
    get(cx_c) = 1 ; // ERROR: Cannot modify a const object

    References

    - [1] The C++ Standard, ISO/IEC 14882:98
    - [2] Plain Old Data + [1] Bjarne Stroustrup, Gabriel Dos Reis, and J. Stephen Adamczyk wrote + various papers, proposing to extend the support for brace-enclosed initializer lists + in the next version of C++. + This would allow a variable var of any DefaultConstructible type + T to be value-initialized by doing T var = {}. + The papers are listed at Bjarne's web page, + My C++ Standards committee papers
    + [2] Scott Meyers, Effective C++, Third Edition, item 6, + Explicitly disallow the use of compiler-generated functions you do not want, + Scott Meyers: Books and CDs
    + [3] The C++ Standard, Second edition (2003), ISO/IEC 14882:2003
    + [4] POD stands for "Plain Old Data" +

    Acknowledgements

    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. - +Special thanks to Björn Karlsson who carefully edited and completed this documentation. + +

    value_initialized was reimplemented by Fernando Cacciola and Niels Dekker +for Boost release version 1.35 (2008), offering a workaround to various compiler issues. +

    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. + href="http://www.boost.org">www.boost.org.


    -

    Revised 19 September 2002

    +

    Revised 15 January 2008

    -

    © Copyright Fernando Cacciola, 2002.

    +

    © Copyright Fernando Cacciola, 2002, 2008.

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

    diff --git a/value_init_test.cpp b/value_init_test.cpp index 4c576a6..7b332d7 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -1,4 +1,4 @@ -// Copyright 2002, Fernando Luis Cacciola Carballal. +// Copyright 2002-2008, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -6,12 +6,15 @@ // // Test program for "boost/utility/value_init.hpp" // -// Initial: 21 Agu 2002 +// 21 Agu 2002 (Created) Fernando Cacciola +// 15 Jan 2008 (Added tests regarding compiler issues) Fernando Cacciola, Niels Dekker +#include // For memcmp. #include #include #include "boost/utility/value_init.hpp" +#include #ifdef __BORLANDC__ #pragma hdrstop @@ -62,6 +65,9 @@ struct NonPOD : NonPODBase // // Sample aggregate POD struct type +// Some compilers do not correctly value-initialize such a struct, for example: +// Borland C++ Report #51854, "Value-initialization: POD struct should be zero-initialized " +// http://qc.codegear.com/wc/qcmain.aspx?d=51854 // struct AggregatePODStruct { @@ -73,6 +79,106 @@ struct AggregatePODStruct bool operator == ( AggregatePODStruct const& lhs, AggregatePODStruct const& rhs ) { return lhs.f == rhs.f && lhs.c == rhs.c && lhs.i == rhs.i ; } +// +// An aggregate struct that contains an std::string and an int. +// Pavel Kuznetsov (MetaCommunications Engineering) used a struct like +// this to reproduce the Microsoft Visual C++ compiler bug, reported as +// Feedback ID 100744, "Value-initialization in new-expression" +// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 +// +struct StringAndInt +{ + std::string s; + int i; +}; + +bool operator == ( StringAndInt const& lhs, StringAndInt const& rhs ) +{ return lhs.s == rhs.s && lhs.i == rhs.i ; } + + +// +// A struct that has an explicit (user defined) destructor. +// Some compilers do not correctly value-initialize such a struct, for example: +// Microsoft Visual C++, Feedback ID 100744, "Value-initialization in new-expression" +// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 +// +struct StructWithDestructor +{ + int i; + ~StructWithDestructor() {} +}; + +bool operator == ( StructWithDestructor const& lhs, StructWithDestructor const& rhs ) +{ return lhs.i == rhs.i ; } + + +// +// A struct that has a virtual function. +// Some compilers do not correctly value-initialize such a struct either, for example: +// Microsoft Visual C++, Feedback ID 100744, "Value-initialization in new-expression" +// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 +// +struct StructWithVirtualFunction +{ + int i; + virtual void VirtualFunction(); +}; + +void StructWithVirtualFunction::VirtualFunction() +{ +} + +bool operator == ( StructWithVirtualFunction const& lhs, StructWithVirtualFunction const& rhs ) +{ return lhs.i == rhs.i ; } + + +// +// A struct that is derived from an aggregate POD struct. +// Some compilers do not correctly value-initialize such a struct, for example: +// GCC Bugzilla Bug 30111, "Value-initialization of POD base class doesn't initialize members", +// reported by Jonathan Wakely, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 +// +struct DerivedFromAggregatePODStruct : AggregatePODStruct +{ + DerivedFromAggregatePODStruct() : AggregatePODStruct() {} +}; + +// +// A struct that wraps an aggregate POD struct as data member. +// +struct AggregatePODStructWrapper +{ + AggregatePODStructWrapper() : dataMember() {} + AggregatePODStruct dataMember; +}; + +bool operator == ( AggregatePODStructWrapper const& lhs, AggregatePODStructWrapper const& rhs ) +{ return lhs.dataMember == rhs.dataMember ; } + +typedef unsigned char ArrayOfBytes[256]; + + +// +// A struct that allows testing whether the appropriate copy functions are called. +// +struct CopyFunctionCallTester +{ + bool is_copy_constructed; + bool is_assignment_called; + + CopyFunctionCallTester() + : is_copy_constructed(false), is_assignment_called(false) {} + + CopyFunctionCallTester(const CopyFunctionCallTester & ) + : is_copy_constructed(true), is_assignment_called(false) {} + + CopyFunctionCallTester & operator=(const CopyFunctionCallTester & ) + { + is_assignment_called = true ; + return *this ; + } +}; + // // This test function tests boost::value_initialized for a specific type T. @@ -97,6 +203,16 @@ bool test ( T const& y, T const& z ) x_c_ref = z ; BOOST_CHECK ( x_c == z ) ; + boost::value_initialized const copy1 = x; + BOOST_CHECK ( boost::get(copy1) == boost::get(x) ) ; + + boost::value_initialized copy2; + copy2 = x; + BOOST_CHECK ( boost::get(copy2) == boost::get(x) ) ; + + boost::shared_ptr > ptr( new boost::value_initialized ); + BOOST_CHECK ( y == *ptr ) ; + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) boost::value_initialized cx ; BOOST_CHECK ( y == cx ) ; @@ -106,6 +222,7 @@ bool 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 ; } @@ -123,13 +240,57 @@ int test_main(int, char **) AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 }; BOOST_CHECK ( test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct) ); + StringAndInt stringAndInt0; + StringAndInt stringAndInt1; + stringAndInt0.i = 0; + stringAndInt1.i = 1; + stringAndInt1.s = std::string("1"); + BOOST_CHECK ( test(stringAndInt0, stringAndInt1) ); + + StructWithDestructor structWithDestructor0; + StructWithDestructor structWithDestructor1; + structWithDestructor0.i = 0; + structWithDestructor1.i = 1; + BOOST_CHECK ( test(structWithDestructor0, structWithDestructor1) ); + + StructWithVirtualFunction structWithVirtualFunction0; + StructWithVirtualFunction structWithVirtualFunction1; + structWithVirtualFunction0.i = 0; + structWithVirtualFunction1.i = 1; + BOOST_CHECK ( test(structWithVirtualFunction0, structWithVirtualFunction1) ); + + DerivedFromAggregatePODStruct derivedFromAggregatePODStruct0; + DerivedFromAggregatePODStruct derivedFromAggregatePODStruct1; + static_cast(derivedFromAggregatePODStruct0) = zeroInitializedAggregatePODStruct; + static_cast(derivedFromAggregatePODStruct1) = nonZeroInitializedAggregatePODStruct; + BOOST_CHECK ( test(derivedFromAggregatePODStruct0, derivedFromAggregatePODStruct1) ); + + AggregatePODStructWrapper aggregatePODStructWrapper0; + AggregatePODStructWrapper aggregatePODStructWrapper1; + aggregatePODStructWrapper0.dataMember = zeroInitializedAggregatePODStruct; + aggregatePODStructWrapper1.dataMember = nonZeroInitializedAggregatePODStruct; + BOOST_CHECK ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) ); + + ArrayOfBytes zeroInitializedArrayOfBytes = { 0 }; + boost::value_initialized valueInitializedArrayOfBytes; + BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0); + + boost::value_initialized copyFunctionCallTester1; + BOOST_CHECK ( ! get(copyFunctionCallTester1).is_copy_constructed); + BOOST_CHECK ( ! get(copyFunctionCallTester1).is_assignment_called); + + boost::value_initialized copyFunctionCallTester2 = boost::value_initialized(copyFunctionCallTester1); + BOOST_CHECK ( get(copyFunctionCallTester2).is_copy_constructed); + BOOST_CHECK ( ! get(copyFunctionCallTester2).is_assignment_called); + + boost::value_initialized copyFunctionCallTester3; + copyFunctionCallTester3 = boost::value_initialized(copyFunctionCallTester1); + BOOST_CHECK ( ! get(copyFunctionCallTester3).is_copy_constructed); + BOOST_CHECK ( get(copyFunctionCallTester3).is_assignment_called); + return 0; } unsigned int expected_failures = 0; - - - - From ab479794f3307b0e8911dbefc69babf6f52e63e6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 10 Feb 2008 16:39:38 +0000 Subject: [PATCH 21/34] Merged revisions 43206,43208-43213 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r43206 | danieljames | 2008-02-10 09:55:03 +0000 (Sun, 10 Feb 2008) | 1 line Fix some broken links. ........ r43209 | danieljames | 2008-02-10 14:56:22 +0000 (Sun, 10 Feb 2008) | 1 line Link to people pages on the website, as they've been removed from the download. ........ r43210 | danieljames | 2008-02-10 15:02:17 +0000 (Sun, 10 Feb 2008) | 1 line Point links to the pages that used to be in 'more' to the site. ........ r43212 | danieljames | 2008-02-10 16:10:16 +0000 (Sun, 10 Feb 2008) | 1 line Fix links on the home page as well. ........ r43213 | danieljames | 2008-02-10 16:21:22 +0000 (Sun, 10 Feb 2008) | 1 line Generated documentation which is no longer generated. ........ [SVN r43214] --- base_from_member.html | 6 +++--- generator_iterator.htm | 2 +- operators.htm | 10 +++++----- utility.htm | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base_from_member.html b/base_from_member.html index 4dd70f4..21ee6d2 100644 --- a/base_from_member.html +++ b/base_from_member.html @@ -334,7 +334,7 @@ with the exact pointer type used in switcher's constructor.

    Contributors

    -
    Ed Brey +
    Ed Brey
    Suggested some interface changes.
    R. Samuel Klatchko (switcher's constructor.

    Invented the idiom of how to use a class member for initializing a base class. -
    Dietmar Kuehl +
    Dietmar Kuehl
    Popularized the base-from-member idiom in his IOStream example classes. @@ -353,7 +353,7 @@ with the exact pointer type used in switcher's constructor.

    can be controlled and automated with macros. The implementation uses the Preprocessor library. -
    Daryle Walker +
    Daryle Walker
    Started the library. Contributed the test file base_from_member_test.cpp.
    diff --git a/generator_iterator.htm b/generator_iterator.htm index c81d3d1..6070522 100644 --- a/generator_iterator.htm +++ b/generator_iterator.htm @@ -153,7 +153,7 @@ int main() 05 December, 2006

    Copyright © 2001 Jens Maurer

    + "http://www.boost.org/people/jens_maurer.htm">Jens Maurer

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or diff --git a/operators.htm b/operators.htm index fca90e5..13d0d0b 100644 --- a/operators.htm +++ b/operators.htm @@ -2029,13 +2029,13 @@ public:

    Contributors

    -
    Dave Abrahams
    +
    Dave Abrahams
    Started the library and contributed the arithmetic operators in boost/operators.hpp.
    -
    Jeremy Siek
    +
    Jeremy Siek
    Contributed the dereference operators and iterator helpers in iterators_test.cpp.
    -
    Aleksey +
    Aleksey Gurtovoy
    Contributed the code to support base class chaining while remaining backward-compatible with old versions of the library.
    -
    Beman Dawes
    +
    Beman Dawes
    Contributed operators_test.cpp.
    -
    Daryle Walker
    +
    Daryle Walker
    Contributed classes for the shift operators, equivalence, partial ordering, and arithmetic conversions. Added the grouped operator diff --git a/utility.htm b/utility.htm index 937a8a3..9514188 100644 --- a/utility.htm +++ b/utility.htm @@ -68,7 +68,7 @@ const std::list<T>::iterator next = boost::next(prev, 2);

    The distance from the given iterator should be supplied as an absolute value. For example, the iterator four iterators prior to the given iterator p may be obtained by prior(p, 4).

    -

    Contributed by Dave Abrahams. Two-argument versions by Daniel Walker.

    +

    Contributed by Dave Abrahams. Two-argument versions by Daniel Walker.

    Class noncopyable

    Class noncopyable is a base class.  Derive your own class from noncopyable when you want to prohibit copy construction @@ -89,7 +89,7 @@ const std::list<T>::iterator next = boost::next(prev, 2);

    to verify class noncopyable 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.

    -

    Contributed by Dave Abrahams.

    +

    Contributed by Dave Abrahams.

    Example

    // inside one of your own headers ...
    
    From 9b52e49fda68c1ce95b7d899ff98f03841edd8dc Mon Sep 17 00:00:00 2001
    From: John Maddock 
    Date: Sat, 15 Mar 2008 18:45:28 +0000
    Subject: [PATCH 22/34] Merge inspection failure fixes from Trunk.
    
    [SVN r43634]
    ---
     call_traits.htm | 30 ++++++++++--------------------
     enable_if.html  | 19 ++++++++++---------
     index.html      |  5 +++--
     3 files changed, 23 insertions(+), 31 deletions(-)
    
    diff --git a/call_traits.htm b/call_traits.htm
    index 6d9bddf..a69c1de 100644
    --- a/call_traits.htm
    +++ b/call_traits.htm
    @@ -740,26 +740,16 @@ specialisation).

    Revised 01 September 2000

    -

    © 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.

    - -

    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.

    - -

    .

    - -

     

    - -

     

    +

    + Copyright 2000 Steve Cleary, Beman Dawes, Howard + Hinnant and John Maddock.
    + Use, modification and distribution are subject to the + Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt + or copy at + http://www.boost.org/LICENSE_1_0.txt + ). +

    diff --git a/enable_if.html b/enable_if.html index 2b6ac0a..a17a290 100644 --- a/enable_if.html +++ b/enable_if.html @@ -366,17 +366,18 @@ David Vandevoorde and Nicolai M. Josuttis. C++ Templates: The Complete Guide. Addison-Wesley, 2002. - - - - -
    - -Contributed by:
    -Jaakko Järvi, Jeremiah Willcock and Andrew Lumsdaine
    +
    +

    Copyright Jaakko Järvi, Jeremiah Willcock and Andrew Lumsdaine
    {jajarvi|jewillco|lums}@osl.iu.edu
    Indiana University
    -Open Systems Lab +Open Systems Lab
    +Use, modification and distribution are subject to the +Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at + http://www.boost.org/LICENSE_1_0.txt +). +

    diff --git a/index.html b/index.html index b08822b..7605aef 100644 --- a/index.html +++ b/index.html @@ -21,14 +21,15 @@ compressed_pair
    current_function
    enable_if
    - iterator_adaptors
    + iterator_adaptors
    + generator iterator adaptors
    operators
    throw_exception
    utility
    value_init


    -

    © Copyright Beman Dawes, 2001

    +

    © Copyright Beman Dawes, 2001

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at From 50bc75a8021c413efd0c04b536742d71653d4cfb Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 21 May 2008 20:57:05 +0000 Subject: [PATCH 23/34] Add minor documentation fixes to the release branch. (I left out the changes to the hash library). Merged via svnmerge from https://svn.boost.org/svn/boost/trunk ................ r44807 | danieljames | 2008-04-27 08:39:49 +0100 (Sun, 27 Apr 2008) | 78 lines Merge in documentation fixes. Apart from the change to optional's documenation Jamfile, which I included by mistake. I wrote about this at: http://lists.boost.org/Archives/boost/2008/04/136405.php Merged revisions 44585-44806 via svnmerge from https://svn.boost.org/svn/boost/branches/doc ........ r44585 | danieljames | 2008-04-19 16:25:27 +0100 (Sat, 19 Apr 2008) | 2 lines Fix broken link to vacpp in bjam docs. ........ r44586 | danieljames | 2008-04-19 16:27:36 +0100 (Sat, 19 Apr 2008) | 2 lines Fix broken link to bcpp in bjam docs. ........ r44587 | danieljames | 2008-04-19 16:33:58 +0100 (Sat, 19 Apr 2008) | 2 lines DateTime documentation - Fix a link to the serialization library. ........ r44588 | danieljames | 2008-04-19 16:35:36 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in interprocess & intrusive. ........ r44589 | danieljames | 2008-04-19 16:37:39 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in the python docs. ........ r44590 | danieljames | 2008-04-19 16:38:29 +0100 (Sat, 19 Apr 2008) | 2 lines Work around a quickbook bug which is affecting the python docs. ........ r44591 | danieljames | 2008-04-19 16:39:34 +0100 (Sat, 19 Apr 2008) | 2 lines Fix a broken link in the numeric conversion docs. ........ r44592 | danieljames | 2008-04-19 16:40:45 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in the optional docs. ........ r44593 | danieljames | 2008-04-19 16:42:09 +0100 (Sat, 19 Apr 2008) | 2 lines Fix link to the hash documentation from bimap. ........ r44599 | danieljames | 2008-04-19 18:07:33 +0100 (Sat, 19 Apr 2008) | 2 lines Fix a typo in the format library. ........ r44600 | danieljames | 2008-04-19 19:20:59 +0100 (Sat, 19 Apr 2008) | 1 line Initialise svnmerge. ........ r44641 | danieljames | 2008-04-20 18:59:47 +0100 (Sun, 20 Apr 2008) | 2 lines Fix the lincense url in shared container iterator documentation. ........ r44642 | danieljames | 2008-04-20 19:00:00 +0100 (Sun, 20 Apr 2008) | 2 lines Fix image link in the mpi documentation. ........ r44643 | danieljames | 2008-04-20 19:00:11 +0100 (Sun, 20 Apr 2008) | 2 lines Fix a typo in the spirit docs. ........ r44644 | danieljames | 2008-04-20 19:00:23 +0100 (Sun, 20 Apr 2008) | 2 lines Escape the slash so that quickbook doesn't think it the start of an italic section, and mess up the link. Refs #1844 ........ r44647 | danieljames | 2008-04-20 19:39:47 +0100 (Sun, 20 Apr 2008) | 2 lines Fix another typo in spirit docs. ........ ................ r45232 | danieljames | 2008-05-08 22:50:19 +0100 (Thu, 08 May 2008) | 1 line Fix some invalid xml by replacing ampersands with character entities. ................ r45576 | danieljames | 2008-05-20 16:39:25 +0100 (Tue, 20 May 2008) | 20 lines Merge some small documentation fixes from the doc branch, and mark some previously merged changes as merged. Merged revisions 44811,45129,45142,45154,45281-45282,45365 via svnmerge from https://svn.boost.org/svn/boost/branches/doc ........ r45129 | danieljames | 2008-05-05 12:36:50 +0100 (Mon, 05 May 2008) | 2 lines Update navbar links in boostbook. ........ r45282 | danieljames | 2008-05-11 14:15:31 +0100 (Sun, 11 May 2008) | 2 lines Group functions in the hash header - requires Frank's free-function-group fix. (not included in release branch). ........ r45365 | danieljames | 2008-05-14 21:39:00 +0100 (Wed, 14 May 2008) | 2 lines Add boost.root to standalone hash documentation. (not included in release branch). ........ ................ [SVN r45622] --- shared_container_iterator.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared_container_iterator.html b/shared_container_iterator.html index dfef648..ed149b5 100644 --- a/shared_container_iterator.html +++ b/shared_container_iterator.html @@ -315,7 +315,7 @@ Last modified: Mon Aug 11 11:27:03 EST 2003

    © Copyright 2003 The Trustees of Indiana University. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at - http:www.boost.org/LICENSE_1_0.txt)

    + http://www.boost.org/LICENSE_1_0.txt)

    From 8849fbc52d5769d9bfc3b1723aaaa79e95c01f00 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 17 Jun 2008 22:14:09 +0000 Subject: [PATCH 24/34] Merged value_init.hpp from trunk, including new boost::initialized_value object. (Was discussed beforehand with Fernando Cacciola.) [SVN r46464] --- include/boost/utility/value_init.hpp | 66 +++++++++++++++++----------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index 097f21a..67127c0 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -1,4 +1,4 @@ -// (C) Copyright 2002-2007, Fernando Luis Cacciola Carballal. +// (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -6,29 +6,20 @@ // // 21 Ago 2002 (Created) Fernando Cacciola // 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker +// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola // #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP // Note: The implementation of boost::value_initialized had to deal with the -// fact that various compilers haven't fully implemented value-initialization: -// Microsoft Feedback ID 100744 - Value-initialization in new-expression -// Reported by Pavel Kuznetsov (MetaCommunications Engineering), 2005-07-28 -// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100744 -// GCC Bug 30111 - Value-initialization of POD base class doesn't initialize members -// Reported by Jonathan Wakely, 2006-12-07 -// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 -// GCC Bug 33916 - Default constructor fails to initialize array members -// Reported by Michael Elizabeth Chastain, 2007-10-26 -// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 -// Borland Report 51854 - Value-initialization: POD struct should be zero-initialized -// Reported by Niels Dekker (LKEB, Leiden University Medical Center), 2007-11-09 -// http://qc.codegear.com/wc/qcmain.aspx?d=51854 -// The constructor of boost::value_initialized works around these issues, by -// clearing the bytes of T, before constructing the T object it contains. +// fact that various compilers haven't fully implemented value-initialization. +// The constructor of boost::value_initialized works around these compiler +// issues, by clearing the bytes of T, before constructing the T object it +// contains. More details on these issues are at libs/utility/value_init.htm #include #include +#include #include #include #include @@ -48,23 +39,32 @@ class value_initialized remove_const::type data; }; - mutable aligned_storage::value> x; + mutable +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + typename +#endif + aligned_storage::value>::type x; + + wrapper * wrapper_address() const + { + return static_cast( static_cast(&x)); + } public : value_initialized() { - std::memset(x.address(), 0, sizeof(x)); + std::memset(&x, 0, sizeof(x)); #ifdef BOOST_MSVC #pragma warning(push) #if _MSC_VER >= 1310 // When using MSVC 7.1 or higher, the following placement new expression may trigger warning C4345: // "behavior change: an object of POD type constructed with an initializer of the form () -// will be default-initialized". There is no need to worry about this, though. +// will be default-initialized". It is safe to ignore this warning when using value_initialized. #pragma warning(disable: 4345) #endif #endif - new (x.address()) wrapper(); + new (wrapper_address()) wrapper(); #ifdef BOOST_MSVC #pragma warning(pop) #endif @@ -72,25 +72,25 @@ class value_initialized value_initialized(value_initialized const & arg) { - new (x.address()) wrapper( *static_cast(arg.x.address()) ); + new (wrapper_address()) wrapper( static_cast(*(arg.wrapper_address()))); } value_initialized & operator=(value_initialized const & arg) { - T & this_data = this->data(); - T const & arg_data = arg.data(); - this_data = arg_data; + // Assignment is only allowed when T is non-const. + BOOST_STATIC_ASSERT( ! is_const::value ); + *wrapper_address() = static_cast(*(arg.wrapper_address())); return *this; } ~value_initialized() { - static_cast(x.address())->wrapper::~wrapper(); + wrapper_address()->wrapper::~wrapper(); } T& data() const { - return static_cast(x.address())->data; + return wrapper_address()->data; } operator T&() const { return this->data(); } @@ -110,6 +110,20 @@ T& get ( value_initialized& x ) return x.data() ; } + +class initialized_value_t +{ + public : + + template operator T() const + { + return get( value_initialized() ); + } +}; + +initialized_value_t const initialized_value = {} ; + + } // namespace boost From 8827b8ed8b79a1ae9f93b1fcd745ae4b57349184 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 17 Jun 2008 22:17:14 +0000 Subject: [PATCH 25/34] Merged value_init doc + test from trunk, including doc and test for boost::initialized_value, that was added with changeset [46464] [SVN r46465] --- value_init.htm | 63 +++++++++++++++++++++++++++++++++++++++++---- value_init_test.cpp | 39 ++++++++++++++++++++++++++-- 2 files changed, 95 insertions(+), 7 deletions(-) diff --git a/value_init.htm b/value_init.htm index 405f0b6..531814e 100644 --- a/value_init.htm +++ b/value_init.htm @@ -28,11 +28,12 @@
    -
    Types
    +
    Types and objects
    Acknowledgements
    @@ -52,6 +53,9 @@ union and class types. Moreover, value_initialized offers a workaround to various compiler issues regarding value-initialization. +Furthermore, a const object, initialized_value is provided, +to avoid repeating the type name when retrieving the value from a +value_initialized<T> object.

    @@ -117,6 +121,16 @@ constructed by the following declaration:
       value_initialized<T> var;
     
    +

    +

    +The const object initialized_value +allows value-initializing a variable as follows: +

    +  T var = initialized_value ;
    +
    +This form of initialization is semantically equivalent to T4 var4 = T4(), +but robust against the aforementioned compiler issues. +

    Details

    @@ -235,7 +249,7 @@ offer a workaround to these issues: value_initialized will now clea its internal data, prior to constructing the object that it contains.

    -

    Types

    +

    Types and objects

    template class value_initialized<T>

    @@ -298,6 +312,43 @@ the wrapped object is always performed with the get() idiom:

    value_initialized<int> x ;
    get(x) = 1 ; // OK

    value_initialized<int const> cx ;
    get(x) = 1 ; // ERROR: Cannot modify a const object

    value_initialized<int> const x_c ;
    get(x_c) = 1 ; // ERROR: Cannot modify a const object

    value_initialized<int const> const cx_c ;
    get(cx_c) = 1 ; // ERROR: Cannot modify a const object
    +

    initialized_value

    + +
    +namespace boost {
    +class initialized_value_t
    +{
    +  public :
    +    template <class T> operator T() const ;
    +};
    +
    +initialized_value_t const initialized_value = {} ;
    +
    +} // namespace boost
    +
    + +initialized_value provides a convenient way to get +an initialized value: its conversion operator provides an appropriate +value-initialized object for any CopyConstructible type. + +Suppose you need to have an initialized variable of type T. +You could do it as follows: +
    +  T var = T();
    +
    +But as mentioned before, this form suffers from various compiler issues. +The template value_initialized offers a workaround: +
    +  T var = get( value_initialized<T>() );
    +
    +Unfortunately both forms repeat the type name, which +is rather short now (T), but could of course be +more like Namespace::Template<Arg>::Type. +Instead, one could use initialized_value as follows: +
    +  T var = initialized_value ;
    +
    +

    References

    [1] Bjarne Stroustrup, Gabriel Dos Reis, and J. Stephen Adamczyk wrote various papers, proposing to extend the support for brace-enclosed initializer lists @@ -320,13 +371,15 @@ Special thanks to Björn Karlsson who carefully edited and completed this do

    value_initialized was reimplemented by Fernando Cacciola and Niels Dekker for Boost release version 1.35 (2008), offering a workaround to various compiler issues.

    +

    initialized_value was written by Niels Dekker, and added to Boost release version 1.36 (2008). +

    Developed by Fernando Cacciola, the latest version of this file can be found at www.boost.org.


    -

    Revised 15 January 2008

    +

    Revised 23 May 2008

    © Copyright Fernando Cacciola, 2002, 2008.

    @@ -337,4 +390,4 @@ for Boost release version 1.35 (2008), offering a workaround to various compiler
    - \ No newline at end of file + diff --git a/value_init_test.cpp b/value_init_test.cpp index 7b332d7..7191156 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -6,8 +6,9 @@ // // Test program for "boost/utility/value_init.hpp" // -// 21 Agu 2002 (Created) Fernando Cacciola +// 21 Ago 2002 (Created) Fernando Cacciola // 15 Jan 2008 (Added tests regarding compiler issues) Fernando Cacciola, Niels Dekker +// 23 May 2008 (Added tests regarding initialized_value) Niels Dekker #include // For memcmp. #include @@ -52,7 +53,7 @@ struct NonPODBase struct NonPOD : NonPODBase { NonPOD () : id() {} - NonPOD ( std::string const& id_) : id(id_) {} + explicit NonPOD ( std::string const& id_) : id(id_) {} friend std::ostream& operator << ( std::ostream& os, NonPOD const& npod ) { return os << '(' << npod.id << ')' ; } @@ -180,6 +181,32 @@ struct CopyFunctionCallTester }; +template +void check_initialized_value ( T const& y ) +{ + T initializedValue = boost::initialized_value ; + BOOST_CHECK ( y == initializedValue ) ; +} + +#ifdef __BORLANDC__ +#if __BORLANDC__ == 0x582 +void check_initialized_value( NonPOD const& ) +{ + // The initialized_value check is skipped for Borland 5.82 + // and this type (NonPOD), because the following statement + // won't compile on this particular compiler version: + // NonPOD initializedValue = boost::initialized_value() ; +// + // This is caused by a compiler bug, that is fixed with a newer version + // of the Borland compiler. The Release Notes for Delphi(R) 2007 for + // Win32(R) and C++Builder(R) 2007 (http://dn.codegear.com/article/36575) + // say about similar statements: + // both of these statements now compile but under 5.82 got the error: + // Error E2015: Ambiguity between 'V::V(const A &)' and 'V::V(const V &)' +} +#endif +#endif + // // 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. @@ -189,9 +216,13 @@ template bool test ( T const& y, T const& z ) { const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter(); + + check_initialized_value(y); + boost::value_initialized x ; BOOST_CHECK ( y == x ) ; BOOST_CHECK ( y == boost::get(x) ) ; + static_cast(x) = z ; boost::get(x) = z ; BOOST_CHECK ( x == z ) ; @@ -275,6 +306,10 @@ int test_main(int, char **) boost::value_initialized valueInitializedArrayOfBytes; BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0); + boost::value_initialized valueInitializedArrayOfBytes2; + valueInitializedArrayOfBytes2 = valueInitializedArrayOfBytes; + BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), get(valueInitializedArrayOfBytes2), sizeof(ArrayOfBytes)) == 0); + boost::value_initialized copyFunctionCallTester1; BOOST_CHECK ( ! get(copyFunctionCallTester1).is_copy_constructed); BOOST_CHECK ( ! get(copyFunctionCallTester1).is_assignment_called); From 492a8ad213f4a7dcc2e52ce4beb345b3070fcab8 Mon Sep 17 00:00:00 2001 From: Anthony Williams Date: Wed, 18 Jun 2008 13:01:08 +0000 Subject: [PATCH 26/34] Merge of new boost.thread code along with required changes from boost.bind [SVN r46474] --- include/boost/utility/addressof.hpp | 43 ++++++++++++++++------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/include/boost/utility/addressof.hpp b/include/boost/utility/addressof.hpp index 7629488..8e0a586 100644 --- a/include/boost/utility/addressof.hpp +++ b/include/boost/utility/addressof.hpp @@ -1,6 +1,7 @@ // Copyright (C) 2002 Brad King (brad.king@kitware.com) // Douglas Gregor (gregod@cs.rpi.edu) -// Peter Dimov +// +// Copyright (C) 2002, 2008 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -14,27 +15,31 @@ # include # include -namespace boost { - -// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov) - -// VC7 strips const from nested classes unless we add indirection here -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - -template struct _addp +namespace boost { - typedef T * type; + +namespace detail +{ + +template struct addressof_impl +{ + static inline T * f( T & v, long ) + { + return reinterpret_cast( + &const_cast(reinterpret_cast(v))); + } + + static inline T * f( T * v, int ) + { + return v; + } }; - -template typename _addp::type -# else -template T* -# endif -addressof(T& v) +} // namespace detail + +template T * addressof( T & v ) { - return reinterpret_cast( - &const_cast(reinterpret_cast(v))); + return boost::detail::addressof_impl::f( v, 0 ); } // Borland doesn't like casting an array reference to a char reference @@ -53,6 +58,6 @@ const T (*addressof(const T (&t)[N]))[N] } # endif -} +} // namespace boost #endif // BOOST_UTILITY_ADDRESSOF_HPP From 17bee9d43fd2b8db688e6f20e6b4bf4bbb11aa85 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sat, 28 Jun 2008 13:57:20 +0000 Subject: [PATCH 27/34] =?UTF-8?q?With=20his=20kind=20permission,=20change?= =?UTF-8?q?=20Jaakko=20"J=C3=A4rvi"=20to=20"Jarvi"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [SVN r46809] --- enable_if/test/constructors.cpp | 2 +- enable_if/test/dummy_arg_disambiguation.cpp | 2 +- enable_if/test/lazy.cpp | 2 +- enable_if/test/lazy_test.cpp | 2 +- enable_if/test/member_templates.cpp | 2 +- enable_if/test/namespace_disambiguation.cpp | 2 +- enable_if/test/no_disambiguation.cpp | 2 +- enable_if/test/partial_specializations.cpp | 2 +- include/boost/ref.hpp | 2 +- include/boost/utility/enable_if.hpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/enable_if/test/constructors.cpp b/enable_if/test/constructors.cpp index 557b2f0..515d9b4 100644 --- a/enable_if/test/constructors.cpp +++ b/enable_if/test/constructors.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/dummy_arg_disambiguation.cpp b/enable_if/test/dummy_arg_disambiguation.cpp index bb9f733..2c9afaf 100644 --- a/enable_if/test/dummy_arg_disambiguation.cpp +++ b/enable_if/test/dummy_arg_disambiguation.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/lazy.cpp b/enable_if/test/lazy.cpp index d766fc9..d41bcd4 100644 --- a/enable_if/test/lazy.cpp +++ b/enable_if/test/lazy.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/lazy_test.cpp b/enable_if/test/lazy_test.cpp index d52d01e..87a595e 100644 --- a/enable_if/test/lazy_test.cpp +++ b/enable_if/test/lazy_test.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/member_templates.cpp b/enable_if/test/member_templates.cpp index 23dd173..62a8e22 100644 --- a/enable_if/test/member_templates.cpp +++ b/enable_if/test/member_templates.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/namespace_disambiguation.cpp b/enable_if/test/namespace_disambiguation.cpp index 90a98a1..15430b1 100644 --- a/enable_if/test/namespace_disambiguation.cpp +++ b/enable_if/test/namespace_disambiguation.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/no_disambiguation.cpp b/enable_if/test/no_disambiguation.cpp index f4936e8..e2488b0 100644 --- a/enable_if/test/no_disambiguation.cpp +++ b/enable_if/test/no_disambiguation.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/enable_if/test/partial_specializations.cpp b/enable_if/test/partial_specializations.cpp index 3dce799..172346e 100644 --- a/enable_if/test/partial_specializations.cpp +++ b/enable_if/test/partial_specializations.cpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/include/boost/ref.hpp b/include/boost/ref.hpp index ab09ae7..330ca65 100644 --- a/include/boost/ref.hpp +++ b/include/boost/ref.hpp @@ -15,7 +15,7 @@ // // ref.hpp - ref/cref, useful helper functions // -// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // Copyright (C) 2001, 2002 Peter Dimov // Copyright (C) 2002 David Abrahams // diff --git a/include/boost/utility/enable_if.hpp b/include/boost/utility/enable_if.hpp index c8b54c4..e076e7b 100644 --- a/include/boost/utility/enable_if.hpp +++ b/include/boost/utility/enable_if.hpp @@ -6,7 +6,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) From e632b0fb1f56e0f3a17349bb8938bf94c0a1a19b Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sat, 28 Jun 2008 18:29:40 +0000 Subject: [PATCH 28/34] Boost Exception In other libraries, watch for compile error referring to throw_exception_assert_compatibility in boost::throw_exception. Resolve by throwing an exception that derives from std::exception. This is not a new requirement but it is being enforced now. [SVN r46818] --- include/boost/exception.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 include/boost/exception.hpp diff --git a/include/boost/exception.hpp b/include/boost/exception.hpp new file mode 100644 index 0000000..d805002 --- /dev/null +++ b/include/boost/exception.hpp @@ -0,0 +1,19 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492 +#define UUID_1D94A7C6054E11DB9804B622A1EF5492 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif From 7a036f6f3a0dfec1b1ee40bc381d9b477b779d7f Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 4 Jul 2008 17:04:47 +0000 Subject: [PATCH 29/34] Merge some small fixes from trunk. Merged revisions 46740,46742,47002,47040 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r46740 | danieljames | 2008-06-26 20:20:56 +0100 (Thu, 26 Jun 2008) | 1 line Fix a character encoding error. ........ r46742 | danieljames | 2008-06-26 20:25:38 +0100 (Thu, 26 Jun 2008) | 6 lines Give the asio documentation its own target. The asio documentation is built with the rest of the combined documentation but is really separate. So give it its own target so that separate parts can be built separately. ........ r47040 | danieljames | 2008-07-03 15:34:56 +0100 (Thu, 03 Jul 2008) | 1 line Workaround for some template syntax not supported in old versions of Visual C++ 6.5 ........ [SVN r47078] --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 7605aef..ff22fb4 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ value_init


    -

    © Copyright Beman Dawes, 2001

    +

    © Copyright Beman Dawes, 2001

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at From 4b24dba257ee35e9e6cc3b8e18c2e449d60d096d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 18 Sep 2008 02:54:03 +0000 Subject: [PATCH 30/34] Replaced copyright symbols with (c) to match trunk [SVN r48842] --- enable_if/test/constructors.cpp | 2 +- enable_if/test/dummy_arg_disambiguation.cpp | 2 +- enable_if/test/lazy.cpp | 2 +- enable_if/test/lazy_test.cpp | 2 +- enable_if/test/member_templates.cpp | 2 +- enable_if/test/namespace_disambiguation.cpp | 2 +- enable_if/test/no_disambiguation.cpp | 2 +- enable_if/test/partial_specializations.cpp | 2 +- include/boost/utility/enable_if.hpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/enable_if/test/constructors.cpp b/enable_if/test/constructors.cpp index 515d9b4..0d465de 100644 --- a/enable_if/test/constructors.cpp +++ b/enable_if/test/constructors.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/dummy_arg_disambiguation.cpp b/enable_if/test/dummy_arg_disambiguation.cpp index 2c9afaf..60dfdfd 100644 --- a/enable_if/test/dummy_arg_disambiguation.cpp +++ b/enable_if/test/dummy_arg_disambiguation.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/lazy.cpp b/enable_if/test/lazy.cpp index d41bcd4..f04111e 100644 --- a/enable_if/test/lazy.cpp +++ b/enable_if/test/lazy.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/lazy_test.cpp b/enable_if/test/lazy_test.cpp index 87a595e..9ec5324 100644 --- a/enable_if/test/lazy_test.cpp +++ b/enable_if/test/lazy_test.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/member_templates.cpp b/enable_if/test/member_templates.cpp index 62a8e22..55e2d80 100644 --- a/enable_if/test/member_templates.cpp +++ b/enable_if/test/member_templates.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/namespace_disambiguation.cpp b/enable_if/test/namespace_disambiguation.cpp index 15430b1..45d4f0a 100644 --- a/enable_if/test/namespace_disambiguation.cpp +++ b/enable_if/test/namespace_disambiguation.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/no_disambiguation.cpp b/enable_if/test/no_disambiguation.cpp index e2488b0..e2416ed 100644 --- a/enable_if/test/no_disambiguation.cpp +++ b/enable_if/test/no_disambiguation.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/enable_if/test/partial_specializations.cpp b/enable_if/test/partial_specializations.cpp index 172346e..1d4db99 100644 --- a/enable_if/test/partial_specializations.cpp +++ b/enable_if/test/partial_specializations.cpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/utility/enable_if.hpp b/include/boost/utility/enable_if.hpp index e076e7b..d292c6a 100644 --- a/include/boost/utility/enable_if.hpp +++ b/include/boost/utility/enable_if.hpp @@ -1,6 +1,6 @@ // Boost enable_if library -// Copyright 2003 © The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at From 10e83b490b95eca97e962ead70731f2a571e7fef Mon Sep 17 00:00:00 2001 From: Matthew Calabrese Date: Fri, 19 Sep 2008 08:19:02 +0000 Subject: [PATCH 31/34] Merged BOOST_BINARY utility macro. [SVN r48879] --- binary_test.cpp | 643 ++++++++++++++++++++++++++++ include/boost/utility.hpp | 3 +- include/boost/utility/binary.hpp | 708 +++++++++++++++++++++++++++++++ test/Jamfile.v2 | 1 + utility.htm | 60 ++- 5 files changed, 1412 insertions(+), 3 deletions(-) create mode 100644 binary_test.cpp create mode 100644 include/boost/utility/binary.hpp diff --git a/binary_test.cpp b/binary_test.cpp new file mode 100644 index 0000000..b4041b3 --- /dev/null +++ b/binary_test.cpp @@ -0,0 +1,643 @@ +/*============================================================================= + Copyright (c) 2006, 2007 Matthew Calabrese + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#include +#include +#include +#include + +/* +Note: This file tests every single valid bit-grouping on its own, and some + random combinations of bit-groupings. +*/ + +std::size_t const num_random_test_values = 32; + +// Note: These hex values should all correspond with the binary array below +unsigned int const random_unsigned_ints_hex[num_random_test_values] + = { 0x0103u, 0x77ebu, 0x5f36u, 0x1f18u, 0xc530u, 0xa73au, 0xd6f8u, 0x0919u + , 0xfbb0u, 0x3e7cu, 0xd0e9u, 0x22c8u, 0x724eu, 0x14fau, 0xd98eu, 0x40b5 + , 0xeba0u, 0xfe50u, 0x688au, 0x1b05u, 0x5f9cu, 0xe4fcu, 0xa7b8u, 0xd3acu + , 0x1dddu, 0xbf04u, 0x8352u, 0xe89cu, 0x7506u, 0xe767u, 0xf489u, 0xe167 + }; + +unsigned int const random_unsigned_ints_binary[num_random_test_values] + = { BOOST_BINARY( 0 00010000 0011 ), BOOST_BINARY( 0 11101 1111 101011 ) + , BOOST_BINARY( 010111 1100110 1 1 0 ), BOOST_BINARY( 000 1 11110 00 11000 ) + , BOOST_BINARY( 110 001010 0110 000 ), BOOST_BINARY( 1010 01110011 1010 ) + , BOOST_BINARY( 11 010 1 101111 1000 ), BOOST_BINARY( 0000 100100 0110 01 ) + , BOOST_BINARY( 1111 101110 11 0000 ), BOOST_BINARY( 00111110 01111100 ) + , BOOST_BINARY( 11 010 000111 01001 ), BOOST_BINARY( 00100 010110 01000 ) + , BOOST_BINARY( 01 11001001 001110 ), BOOST_BINARY( 0010 1001111 1010 ) + , BOOST_BINARY( 1101 1 00110 0 01110 ), BOOST_BINARY( 100 000 01011010 1 ) + , BOOST_BINARY( 11 1010 1110 1000 00 ), BOOST_BINARY( 11111 110010 10000 ) + , BOOST_BINARY( 01101 00010 001010 ), BOOST_BINARY( 000 11011 000001 01 ) + , BOOST_BINARY( 01 01111 1100111 00 ), BOOST_BINARY( 1 110010 0111111 00 ) + , BOOST_BINARY( 101 0011 11 01110 00 ), BOOST_BINARY( 110100 1 110101 100 ) + , BOOST_BINARY( 00 1110111 011 101 ), BOOST_BINARY( 1011 1111 00000 100 ) + , BOOST_BINARY( 1000 00110 101 0010 ), BOOST_BINARY( 1110 10001 001110 0 ) + , BOOST_BINARY( 011 1010100 000 110 ), BOOST_BINARY( 1110 0111 01100 111 ) + , BOOST_BINARY( 11110 10010 001001 ), BOOST_BINARY( 11 1000010 1100 111 ) + }; + +unsigned int const unsigned_ints_1_bit[2] = +{ BOOST_BINARY( 0 ) +, BOOST_BINARY( 1 ) +}; + +unsigned int const unsigned_ints_2_bits[4] = +{ BOOST_BINARY( 00 ) +, BOOST_BINARY( 01 ) +, BOOST_BINARY( 10 ) +, BOOST_BINARY( 11 ) +}; + +unsigned int const unsigned_ints_3_bits[8] = +{ BOOST_BINARY( 000 ) +, BOOST_BINARY( 001 ) +, BOOST_BINARY( 010 ) +, BOOST_BINARY( 011 ) +, BOOST_BINARY( 100 ) +, BOOST_BINARY( 101 ) +, BOOST_BINARY( 110 ) +, BOOST_BINARY( 111 ) +}; + +unsigned int const unsigned_ints_4_bits[16] = +{ BOOST_BINARY( 0000 ) +, BOOST_BINARY( 0001 ) +, BOOST_BINARY( 0010 ) +, BOOST_BINARY( 0011 ) +, BOOST_BINARY( 0100 ) +, BOOST_BINARY( 0101 ) +, BOOST_BINARY( 0110 ) +, BOOST_BINARY( 0111 ) +, BOOST_BINARY( 1000 ) +, BOOST_BINARY( 1001 ) +, BOOST_BINARY( 1010 ) +, BOOST_BINARY( 1011 ) +, BOOST_BINARY( 1100 ) +, BOOST_BINARY( 1101 ) +, BOOST_BINARY( 1110 ) +, BOOST_BINARY( 1111 ) +}; + +unsigned int const unsigned_ints_5_bits[32] = +{ BOOST_BINARY( 00000 ) +, BOOST_BINARY( 00001 ) +, BOOST_BINARY( 00010 ) +, BOOST_BINARY( 00011 ) +, BOOST_BINARY( 00100 ) +, BOOST_BINARY( 00101 ) +, BOOST_BINARY( 00110 ) +, BOOST_BINARY( 00111 ) +, BOOST_BINARY( 01000 ) +, BOOST_BINARY( 01001 ) +, BOOST_BINARY( 01010 ) +, BOOST_BINARY( 01011 ) +, BOOST_BINARY( 01100 ) +, BOOST_BINARY( 01101 ) +, BOOST_BINARY( 01110 ) +, BOOST_BINARY( 01111 ) +, BOOST_BINARY( 10000 ) +, BOOST_BINARY( 10001 ) +, BOOST_BINARY( 10010 ) +, BOOST_BINARY( 10011 ) +, BOOST_BINARY( 10100 ) +, BOOST_BINARY( 10101 ) +, BOOST_BINARY( 10110 ) +, BOOST_BINARY( 10111 ) +, BOOST_BINARY( 11000 ) +, BOOST_BINARY( 11001 ) +, BOOST_BINARY( 11010 ) +, BOOST_BINARY( 11011 ) +, BOOST_BINARY( 11100 ) +, BOOST_BINARY( 11101 ) +, BOOST_BINARY( 11110 ) +, BOOST_BINARY( 11111 ) +}; + +unsigned int const unsigned_ints_6_bits[64] = +{ BOOST_BINARY( 000000 ) +, BOOST_BINARY( 000001 ) +, BOOST_BINARY( 000010 ) +, BOOST_BINARY( 000011 ) +, BOOST_BINARY( 000100 ) +, BOOST_BINARY( 000101 ) +, BOOST_BINARY( 000110 ) +, BOOST_BINARY( 000111 ) +, BOOST_BINARY( 001000 ) +, BOOST_BINARY( 001001 ) +, BOOST_BINARY( 001010 ) +, BOOST_BINARY( 001011 ) +, BOOST_BINARY( 001100 ) +, BOOST_BINARY( 001101 ) +, BOOST_BINARY( 001110 ) +, BOOST_BINARY( 001111 ) +, BOOST_BINARY( 010000 ) +, BOOST_BINARY( 010001 ) +, BOOST_BINARY( 010010 ) +, BOOST_BINARY( 010011 ) +, BOOST_BINARY( 010100 ) +, BOOST_BINARY( 010101 ) +, BOOST_BINARY( 010110 ) +, BOOST_BINARY( 010111 ) +, BOOST_BINARY( 011000 ) +, BOOST_BINARY( 011001 ) +, BOOST_BINARY( 011010 ) +, BOOST_BINARY( 011011 ) +, BOOST_BINARY( 011100 ) +, BOOST_BINARY( 011101 ) +, BOOST_BINARY( 011110 ) +, BOOST_BINARY( 011111 ) +, BOOST_BINARY( 100000 ) +, BOOST_BINARY( 100001 ) +, BOOST_BINARY( 100010 ) +, BOOST_BINARY( 100011 ) +, BOOST_BINARY( 100100 ) +, BOOST_BINARY( 100101 ) +, BOOST_BINARY( 100110 ) +, BOOST_BINARY( 100111 ) +, BOOST_BINARY( 101000 ) +, BOOST_BINARY( 101001 ) +, BOOST_BINARY( 101010 ) +, BOOST_BINARY( 101011 ) +, BOOST_BINARY( 101100 ) +, BOOST_BINARY( 101101 ) +, BOOST_BINARY( 101110 ) +, BOOST_BINARY( 101111 ) +, BOOST_BINARY( 110000 ) +, BOOST_BINARY( 110001 ) +, BOOST_BINARY( 110010 ) +, BOOST_BINARY( 110011 ) +, BOOST_BINARY( 110100 ) +, BOOST_BINARY( 110101 ) +, BOOST_BINARY( 110110 ) +, BOOST_BINARY( 110111 ) +, BOOST_BINARY( 111000 ) +, BOOST_BINARY( 111001 ) +, BOOST_BINARY( 111010 ) +, BOOST_BINARY( 111011 ) +, BOOST_BINARY( 111100 ) +, BOOST_BINARY( 111101 ) +, BOOST_BINARY( 111110 ) +, BOOST_BINARY( 111111 ) +}; + +unsigned int const unsigned_ints_7_bits[128] = +{ BOOST_BINARY( 0000000 ) +, BOOST_BINARY( 0000001 ) +, BOOST_BINARY( 0000010 ) +, BOOST_BINARY( 0000011 ) +, BOOST_BINARY( 0000100 ) +, BOOST_BINARY( 0000101 ) +, BOOST_BINARY( 0000110 ) +, BOOST_BINARY( 0000111 ) +, BOOST_BINARY( 0001000 ) +, BOOST_BINARY( 0001001 ) +, BOOST_BINARY( 0001010 ) +, BOOST_BINARY( 0001011 ) +, BOOST_BINARY( 0001100 ) +, BOOST_BINARY( 0001101 ) +, BOOST_BINARY( 0001110 ) +, BOOST_BINARY( 0001111 ) +, BOOST_BINARY( 0010000 ) +, BOOST_BINARY( 0010001 ) +, BOOST_BINARY( 0010010 ) +, BOOST_BINARY( 0010011 ) +, BOOST_BINARY( 0010100 ) +, BOOST_BINARY( 0010101 ) +, BOOST_BINARY( 0010110 ) +, BOOST_BINARY( 0010111 ) +, BOOST_BINARY( 0011000 ) +, BOOST_BINARY( 0011001 ) +, BOOST_BINARY( 0011010 ) +, BOOST_BINARY( 0011011 ) +, BOOST_BINARY( 0011100 ) +, BOOST_BINARY( 0011101 ) +, BOOST_BINARY( 0011110 ) +, BOOST_BINARY( 0011111 ) +, BOOST_BINARY( 0100000 ) +, BOOST_BINARY( 0100001 ) +, BOOST_BINARY( 0100010 ) +, BOOST_BINARY( 0100011 ) +, BOOST_BINARY( 0100100 ) +, BOOST_BINARY( 0100101 ) +, BOOST_BINARY( 0100110 ) +, BOOST_BINARY( 0100111 ) +, BOOST_BINARY( 0101000 ) +, BOOST_BINARY( 0101001 ) +, BOOST_BINARY( 0101010 ) +, BOOST_BINARY( 0101011 ) +, BOOST_BINARY( 0101100 ) +, BOOST_BINARY( 0101101 ) +, BOOST_BINARY( 0101110 ) +, BOOST_BINARY( 0101111 ) +, BOOST_BINARY( 0110000 ) +, BOOST_BINARY( 0110001 ) +, BOOST_BINARY( 0110010 ) +, BOOST_BINARY( 0110011 ) +, BOOST_BINARY( 0110100 ) +, BOOST_BINARY( 0110101 ) +, BOOST_BINARY( 0110110 ) +, BOOST_BINARY( 0110111 ) +, BOOST_BINARY( 0111000 ) +, BOOST_BINARY( 0111001 ) +, BOOST_BINARY( 0111010 ) +, BOOST_BINARY( 0111011 ) +, BOOST_BINARY( 0111100 ) +, BOOST_BINARY( 0111101 ) +, BOOST_BINARY( 0111110 ) +, BOOST_BINARY( 0111111 ) +, BOOST_BINARY( 1000000 ) +, BOOST_BINARY( 1000001 ) +, BOOST_BINARY( 1000010 ) +, BOOST_BINARY( 1000011 ) +, BOOST_BINARY( 1000100 ) +, BOOST_BINARY( 1000101 ) +, BOOST_BINARY( 1000110 ) +, BOOST_BINARY( 1000111 ) +, BOOST_BINARY( 1001000 ) +, BOOST_BINARY( 1001001 ) +, BOOST_BINARY( 1001010 ) +, BOOST_BINARY( 1001011 ) +, BOOST_BINARY( 1001100 ) +, BOOST_BINARY( 1001101 ) +, BOOST_BINARY( 1001110 ) +, BOOST_BINARY( 1001111 ) +, BOOST_BINARY( 1010000 ) +, BOOST_BINARY( 1010001 ) +, BOOST_BINARY( 1010010 ) +, BOOST_BINARY( 1010011 ) +, BOOST_BINARY( 1010100 ) +, BOOST_BINARY( 1010101 ) +, BOOST_BINARY( 1010110 ) +, BOOST_BINARY( 1010111 ) +, BOOST_BINARY( 1011000 ) +, BOOST_BINARY( 1011001 ) +, BOOST_BINARY( 1011010 ) +, BOOST_BINARY( 1011011 ) +, BOOST_BINARY( 1011100 ) +, BOOST_BINARY( 1011101 ) +, BOOST_BINARY( 1011110 ) +, BOOST_BINARY( 1011111 ) +, BOOST_BINARY( 1100000 ) +, BOOST_BINARY( 1100001 ) +, BOOST_BINARY( 1100010 ) +, BOOST_BINARY( 1100011 ) +, BOOST_BINARY( 1100100 ) +, BOOST_BINARY( 1100101 ) +, BOOST_BINARY( 1100110 ) +, BOOST_BINARY( 1100111 ) +, BOOST_BINARY( 1101000 ) +, BOOST_BINARY( 1101001 ) +, BOOST_BINARY( 1101010 ) +, BOOST_BINARY( 1101011 ) +, BOOST_BINARY( 1101100 ) +, BOOST_BINARY( 1101101 ) +, BOOST_BINARY( 1101110 ) +, BOOST_BINARY( 1101111 ) +, BOOST_BINARY( 1110000 ) +, BOOST_BINARY( 1110001 ) +, BOOST_BINARY( 1110010 ) +, BOOST_BINARY( 1110011 ) +, BOOST_BINARY( 1110100 ) +, BOOST_BINARY( 1110101 ) +, BOOST_BINARY( 1110110 ) +, BOOST_BINARY( 1110111 ) +, BOOST_BINARY( 1111000 ) +, BOOST_BINARY( 1111001 ) +, BOOST_BINARY( 1111010 ) +, BOOST_BINARY( 1111011 ) +, BOOST_BINARY( 1111100 ) +, BOOST_BINARY( 1111101 ) +, BOOST_BINARY( 1111110 ) +, BOOST_BINARY( 1111111 ) +}; +unsigned int const unsigned_ints_8_bits[256] = +{ BOOST_BINARY( 00000000 ) +, BOOST_BINARY( 00000001 ) +, BOOST_BINARY( 00000010 ) +, BOOST_BINARY( 00000011 ) +, BOOST_BINARY( 00000100 ) +, BOOST_BINARY( 00000101 ) +, BOOST_BINARY( 00000110 ) +, BOOST_BINARY( 00000111 ) +, BOOST_BINARY( 00001000 ) +, BOOST_BINARY( 00001001 ) +, BOOST_BINARY( 00001010 ) +, BOOST_BINARY( 00001011 ) +, BOOST_BINARY( 00001100 ) +, BOOST_BINARY( 00001101 ) +, BOOST_BINARY( 00001110 ) +, BOOST_BINARY( 00001111 ) +, BOOST_BINARY( 00010000 ) +, BOOST_BINARY( 00010001 ) +, BOOST_BINARY( 00010010 ) +, BOOST_BINARY( 00010011 ) +, BOOST_BINARY( 00010100 ) +, BOOST_BINARY( 00010101 ) +, BOOST_BINARY( 00010110 ) +, BOOST_BINARY( 00010111 ) +, BOOST_BINARY( 00011000 ) +, BOOST_BINARY( 00011001 ) +, BOOST_BINARY( 00011010 ) +, BOOST_BINARY( 00011011 ) +, BOOST_BINARY( 00011100 ) +, BOOST_BINARY( 00011101 ) +, BOOST_BINARY( 00011110 ) +, BOOST_BINARY( 00011111 ) +, BOOST_BINARY( 00100000 ) +, BOOST_BINARY( 00100001 ) +, BOOST_BINARY( 00100010 ) +, BOOST_BINARY( 00100011 ) +, BOOST_BINARY( 00100100 ) +, BOOST_BINARY( 00100101 ) +, BOOST_BINARY( 00100110 ) +, BOOST_BINARY( 00100111 ) +, BOOST_BINARY( 00101000 ) +, BOOST_BINARY( 00101001 ) +, BOOST_BINARY( 00101010 ) +, BOOST_BINARY( 00101011 ) +, BOOST_BINARY( 00101100 ) +, BOOST_BINARY( 00101101 ) +, BOOST_BINARY( 00101110 ) +, BOOST_BINARY( 00101111 ) +, BOOST_BINARY( 00110000 ) +, BOOST_BINARY( 00110001 ) +, BOOST_BINARY( 00110010 ) +, BOOST_BINARY( 00110011 ) +, BOOST_BINARY( 00110100 ) +, BOOST_BINARY( 00110101 ) +, BOOST_BINARY( 00110110 ) +, BOOST_BINARY( 00110111 ) +, BOOST_BINARY( 00111000 ) +, BOOST_BINARY( 00111001 ) +, BOOST_BINARY( 00111010 ) +, BOOST_BINARY( 00111011 ) +, BOOST_BINARY( 00111100 ) +, BOOST_BINARY( 00111101 ) +, BOOST_BINARY( 00111110 ) +, BOOST_BINARY( 00111111 ) +, BOOST_BINARY( 01000000 ) +, BOOST_BINARY( 01000001 ) +, BOOST_BINARY( 01000010 ) +, BOOST_BINARY( 01000011 ) +, BOOST_BINARY( 01000100 ) +, BOOST_BINARY( 01000101 ) +, BOOST_BINARY( 01000110 ) +, BOOST_BINARY( 01000111 ) +, BOOST_BINARY( 01001000 ) +, BOOST_BINARY( 01001001 ) +, BOOST_BINARY( 01001010 ) +, BOOST_BINARY( 01001011 ) +, BOOST_BINARY( 01001100 ) +, BOOST_BINARY( 01001101 ) +, BOOST_BINARY( 01001110 ) +, BOOST_BINARY( 01001111 ) +, BOOST_BINARY( 01010000 ) +, BOOST_BINARY( 01010001 ) +, BOOST_BINARY( 01010010 ) +, BOOST_BINARY( 01010011 ) +, BOOST_BINARY( 01010100 ) +, BOOST_BINARY( 01010101 ) +, BOOST_BINARY( 01010110 ) +, BOOST_BINARY( 01010111 ) +, BOOST_BINARY( 01011000 ) +, BOOST_BINARY( 01011001 ) +, BOOST_BINARY( 01011010 ) +, BOOST_BINARY( 01011011 ) +, BOOST_BINARY( 01011100 ) +, BOOST_BINARY( 01011101 ) +, BOOST_BINARY( 01011110 ) +, BOOST_BINARY( 01011111 ) +, BOOST_BINARY( 01100000 ) +, BOOST_BINARY( 01100001 ) +, BOOST_BINARY( 01100010 ) +, BOOST_BINARY( 01100011 ) +, BOOST_BINARY( 01100100 ) +, BOOST_BINARY( 01100101 ) +, BOOST_BINARY( 01100110 ) +, BOOST_BINARY( 01100111 ) +, BOOST_BINARY( 01101000 ) +, BOOST_BINARY( 01101001 ) +, BOOST_BINARY( 01101010 ) +, BOOST_BINARY( 01101011 ) +, BOOST_BINARY( 01101100 ) +, BOOST_BINARY( 01101101 ) +, BOOST_BINARY( 01101110 ) +, BOOST_BINARY( 01101111 ) +, BOOST_BINARY( 01110000 ) +, BOOST_BINARY( 01110001 ) +, BOOST_BINARY( 01110010 ) +, BOOST_BINARY( 01110011 ) +, BOOST_BINARY( 01110100 ) +, BOOST_BINARY( 01110101 ) +, BOOST_BINARY( 01110110 ) +, BOOST_BINARY( 01110111 ) +, BOOST_BINARY( 01111000 ) +, BOOST_BINARY( 01111001 ) +, BOOST_BINARY( 01111010 ) +, BOOST_BINARY( 01111011 ) +, BOOST_BINARY( 01111100 ) +, BOOST_BINARY( 01111101 ) +, BOOST_BINARY( 01111110 ) +, BOOST_BINARY( 01111111 ) +, BOOST_BINARY( 10000000 ) +, BOOST_BINARY( 10000001 ) +, BOOST_BINARY( 10000010 ) +, BOOST_BINARY( 10000011 ) +, BOOST_BINARY( 10000100 ) +, BOOST_BINARY( 10000101 ) +, BOOST_BINARY( 10000110 ) +, BOOST_BINARY( 10000111 ) +, BOOST_BINARY( 10001000 ) +, BOOST_BINARY( 10001001 ) +, BOOST_BINARY( 10001010 ) +, BOOST_BINARY( 10001011 ) +, BOOST_BINARY( 10001100 ) +, BOOST_BINARY( 10001101 ) +, BOOST_BINARY( 10001110 ) +, BOOST_BINARY( 10001111 ) +, BOOST_BINARY( 10010000 ) +, BOOST_BINARY( 10010001 ) +, BOOST_BINARY( 10010010 ) +, BOOST_BINARY( 10010011 ) +, BOOST_BINARY( 10010100 ) +, BOOST_BINARY( 10010101 ) +, BOOST_BINARY( 10010110 ) +, BOOST_BINARY( 10010111 ) +, BOOST_BINARY( 10011000 ) +, BOOST_BINARY( 10011001 ) +, BOOST_BINARY( 10011010 ) +, BOOST_BINARY( 10011011 ) +, BOOST_BINARY( 10011100 ) +, BOOST_BINARY( 10011101 ) +, BOOST_BINARY( 10011110 ) +, BOOST_BINARY( 10011111 ) +, BOOST_BINARY( 10100000 ) +, BOOST_BINARY( 10100001 ) +, BOOST_BINARY( 10100010 ) +, BOOST_BINARY( 10100011 ) +, BOOST_BINARY( 10100100 ) +, BOOST_BINARY( 10100101 ) +, BOOST_BINARY( 10100110 ) +, BOOST_BINARY( 10100111 ) +, BOOST_BINARY( 10101000 ) +, BOOST_BINARY( 10101001 ) +, BOOST_BINARY( 10101010 ) +, BOOST_BINARY( 10101011 ) +, BOOST_BINARY( 10101100 ) +, BOOST_BINARY( 10101101 ) +, BOOST_BINARY( 10101110 ) +, BOOST_BINARY( 10101111 ) +, BOOST_BINARY( 10110000 ) +, BOOST_BINARY( 10110001 ) +, BOOST_BINARY( 10110010 ) +, BOOST_BINARY( 10110011 ) +, BOOST_BINARY( 10110100 ) +, BOOST_BINARY( 10110101 ) +, BOOST_BINARY( 10110110 ) +, BOOST_BINARY( 10110111 ) +, BOOST_BINARY( 10111000 ) +, BOOST_BINARY( 10111001 ) +, BOOST_BINARY( 10111010 ) +, BOOST_BINARY( 10111011 ) +, BOOST_BINARY( 10111100 ) +, BOOST_BINARY( 10111101 ) +, BOOST_BINARY( 10111110 ) +, BOOST_BINARY( 10111111 ) +, BOOST_BINARY( 11000000 ) +, BOOST_BINARY( 11000001 ) +, BOOST_BINARY( 11000010 ) +, BOOST_BINARY( 11000011 ) +, BOOST_BINARY( 11000100 ) +, BOOST_BINARY( 11000101 ) +, BOOST_BINARY( 11000110 ) +, BOOST_BINARY( 11000111 ) +, BOOST_BINARY( 11001000 ) +, BOOST_BINARY( 11001001 ) +, BOOST_BINARY( 11001010 ) +, BOOST_BINARY( 11001011 ) +, BOOST_BINARY( 11001100 ) +, BOOST_BINARY( 11001101 ) +, BOOST_BINARY( 11001110 ) +, BOOST_BINARY( 11001111 ) +, BOOST_BINARY( 11010000 ) +, BOOST_BINARY( 11010001 ) +, BOOST_BINARY( 11010010 ) +, BOOST_BINARY( 11010011 ) +, BOOST_BINARY( 11010100 ) +, BOOST_BINARY( 11010101 ) +, BOOST_BINARY( 11010110 ) +, BOOST_BINARY( 11010111 ) +, BOOST_BINARY( 11011000 ) +, BOOST_BINARY( 11011001 ) +, BOOST_BINARY( 11011010 ) +, BOOST_BINARY( 11011011 ) +, BOOST_BINARY( 11011100 ) +, BOOST_BINARY( 11011101 ) +, BOOST_BINARY( 11011110 ) +, BOOST_BINARY( 11011111 ) +, BOOST_BINARY( 11100000 ) +, BOOST_BINARY( 11100001 ) +, BOOST_BINARY( 11100010 ) +, BOOST_BINARY( 11100011 ) +, BOOST_BINARY( 11100100 ) +, BOOST_BINARY( 11100101 ) +, BOOST_BINARY( 11100110 ) +, BOOST_BINARY( 11100111 ) +, BOOST_BINARY( 11101000 ) +, BOOST_BINARY( 11101001 ) +, BOOST_BINARY( 11101010 ) +, BOOST_BINARY( 11101011 ) +, BOOST_BINARY( 11101100 ) +, BOOST_BINARY( 11101101 ) +, BOOST_BINARY( 11101110 ) +, BOOST_BINARY( 11101111 ) +, BOOST_BINARY( 11110000 ) +, BOOST_BINARY( 11110001 ) +, BOOST_BINARY( 11110010 ) +, BOOST_BINARY( 11110011 ) +, BOOST_BINARY( 11110100 ) +, BOOST_BINARY( 11110101 ) +, BOOST_BINARY( 11110110 ) +, BOOST_BINARY( 11110111 ) +, BOOST_BINARY( 11111000 ) +, BOOST_BINARY( 11111001 ) +, BOOST_BINARY( 11111010 ) +, BOOST_BINARY( 11111011 ) +, BOOST_BINARY( 11111100 ) +, BOOST_BINARY( 11111101 ) +, BOOST_BINARY( 11111110 ) +, BOOST_BINARY( 11111111 ) +}; + +struct left_is_not_one_less_than_right +{ + bool operator ()( unsigned int left, unsigned int right ) const + { + return right != left + 1; + } +}; + +template< std::size_t Size > +bool is_ascending_from_0_array( unsigned int const (&array)[Size] ) +{ + unsigned int const* const curr = array, + * const end = array + Size; + + return ( *curr == 0 ) + && ( std::adjacent_find( curr, end + , left_is_not_one_less_than_right() + ) + == end + ); +} + +std::size_t const unsigned_int_id = 1, + unsigned_long_int_id = 2; + +typedef char (&unsigned_int_id_type)[unsigned_int_id]; +typedef char (&unsigned_long_int_id_type)[unsigned_long_int_id]; + +// Note: Functions only used for type checking +unsigned_int_id_type binary_type_checker( unsigned int ); +unsigned_long_int_id_type binary_type_checker( unsigned long int ); + +int test_main( int, char *[] ) +{ + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_1_bit ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_2_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_3_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_4_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_5_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_6_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_7_bits ) ); + BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_8_bits ) ); + + BOOST_CHECK( std::equal( &random_unsigned_ints_hex[0] + , random_unsigned_ints_hex + num_random_test_values + , &random_unsigned_ints_binary[0] + ) + ); + + BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_U( 110100 1010 ) ) ) + == unsigned_int_id + ); + + BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_UL( 11110 ) ) ) + == unsigned_long_int_id + ); + + BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_LU( 10 0001 ) ) ) + == unsigned_long_int_id + ); + + return 0; +} diff --git a/include/boost/utility.hpp b/include/boost/utility.hpp index 211d89d..b909f29 100644 --- a/include/boost/utility.hpp +++ b/include/boost/utility.hpp @@ -10,7 +10,8 @@ #define BOOST_UTILITY_HPP #include -#include +#include +#include #include #include #include diff --git a/include/boost/utility/binary.hpp b/include/boost/utility/binary.hpp new file mode 100644 index 0000000..8cef146 --- /dev/null +++ b/include/boost/utility/binary.hpp @@ -0,0 +1,708 @@ +/*============================================================================= + Copyright (c) 2005 Matthew Calabrese + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_UTILITY_BINARY_HPP +#define BOOST_UTILITY_BINARY_HPP + +/*============================================================================= + + Binary Literal Utility + ______________________ + + + The following code works by converting the input bit pattern into a + Boost.Preprocessor sequence, then converting groupings of 3 bits each into + the corresponding octal digit, and finally concatenating all of the digits + together along with a leading zero. This yields a standard octal literal + with the desired value as specified in bits. + +==============================================================================*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_BINARY( bit_groupings ) \ + BOOST_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings ) + +#define BOOST_BINARY_U( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, U ) + +#define BOOST_BINARY_L( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, L ) + +#define BOOST_BINARY_UL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, UL ) + +#define BOOST_BINARY_LU( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LU ) + +#define BOOST_BINARY_LL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LL ) + +#define BOOST_BINARY_ULL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, ULL ) + +#define BOOST_BINARY_LLU( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LLU ) + +#define BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, suffix ) \ + BOOST_SUFFIXED_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings, suffix ) + +#define BOOST_SUFFIXED_BINARY_LITERAL_D( d, bit_groupings, suffix ) \ + BOOST_PP_CAT( BOOST_BINARY_LITERAL_D( d, bit_groupings ), suffix ) + +#define BOOST_BINARY_LITERAL_D( d, bit_groupings ) \ + BOOST_PP_SEQ_CAT \ + ( (0) BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \ + ) + +#define BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \ + BOOST_PP_SEQ_TRANSFORM \ + ( BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION \ + , BOOST_PP_NIL \ + , BOOST_PP_IDENTITY( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE )()\ + ( BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE \ + ( \ + d \ + , BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \ + ) \ + ) \ + ) + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE( bit_sequence ) \ + BOOST_PP_CAT \ + ( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1 bit_sequence \ + , END_BIT \ + ) + +#define BOOST_DETAIL_BITS_PER_OCTIT 3 + +#define BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE( d, incomplete_nibble_sequence ) \ + BOOST_PP_CAT \ + ( BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_ \ + , BOOST_PP_MOD_D( d \ + , BOOST_PP_SEQ_SIZE( incomplete_nibble_sequence ) \ + , BOOST_DETAIL_BITS_PER_OCTIT \ + ) \ + ) \ + incomplete_nibble_sequence + +#define BOOST_DETAIL_FIXED_COMPL( bit ) \ + BOOST_PP_CAT( BOOST_DETAIL_FIXED_COMPL_, bit ) + +#define BOOST_DETAIL_FIXED_COMPL_0 1 + +#define BOOST_DETAIL_FIXED_COMPL_1 0 + +#define BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \ + BOOST_PP_EMPTY \ + BOOST_PP_CAT( BOOST_PP_WHILE_, d ) \ + ( BOOST_DETAIL_BINARY_LITERAL_PREDICATE \ + , BOOST_DETAIL_BINARY_LITERAL_OPERATION \ + , bit_groupings () \ + ) + +#define BOOST_DETAIL_BINARY_LITERAL_PREDICATE( d, state ) \ + BOOST_DETAIL_FIXED_COMPL( BOOST_DETAIL_IS_NULLARY_ARGS( state ) ) + +#define BOOST_DETAIL_BINARY_LITERAL_OPERATION( d, state ) \ + BOOST_DETAIL_SPLIT_AND_SWAP \ + ( BOOST_PP_CAT( BOOST_DETAIL_BINARY_LITERAL_ELEMENT_, state ) ) + +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION( s, dummy_param, tuple ) \ + BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL tuple + +#define BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL( bit2, bit1, bit0 ) \ + BOOST_DETAIL_TRIPLE_TO_OCTAL_ ## bit2 ## bit1 ## bit0 + +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_1 (0)(0) +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_2 (0) +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_0 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1END_BIT + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1( bit ) \ + ( ( bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2( bit ) \ + bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3( bit ) \ + bit ) ) BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1 + +#define BOOST_DETAIL_SPLIT_AND_SWAP( params ) \ + BOOST_PP_IDENTITY( BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS )()( params ) + +#define BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS( first_param, second_param ) \ + second_param first_param + +#define BOOST_DETAIL_LEFT_OF_COMMA( params ) \ + BOOST_PP_IDENTITY( BOOST_DETAIL_FIRST_MACRO_PARAM )()( params ) + +#define BOOST_DETAIL_FIRST_MACRO_PARAM( first_param, second_param ) \ + first_param + +/* Begin derived concepts from Chaos by Paul Mensonides */ + +#define BOOST_DETAIL_IS_NULLARY_ARGS( param ) \ + BOOST_DETAIL_LEFT_OF_COMMA \ + ( BOOST_PP_CAT( BOOST_DETAIL_IS_NULLARY_ARGS_R_ \ + , BOOST_DETAIL_IS_NULLARY_ARGS_C param \ + ) \ + ) + +#define BOOST_DETAIL_IS_NULLARY_ARGS_C() \ + 1 + +#define BOOST_DETAIL_IS_NULLARY_ARGS_R_1 \ + 1, BOOST_PP_NIL + +#define BOOST_DETAIL_IS_NULLARY_ARGS_R_BOOST_DETAIL_IS_NULLARY_ARGS_C \ + 0, BOOST_PP_NIL + +/* End derived concepts from Chaos by Paul Mensonides */ + +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_000 0 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_001 1 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_010 2 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_011 3 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_100 4 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_101 5 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_110 6 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_111 7 + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0 (0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1 (1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000 (0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001 (0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010 (0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011 (0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100 (1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101 (1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110 (1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111 (1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000 (0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001 (0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010 (0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011 (0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100 (0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101 (0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110 (0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111 (0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000 (1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001 (1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010 (1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011 (1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100 (1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101 (1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110 (1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111 (1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000 (0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001 (0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010 (0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011 (0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100 (0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101 (0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110 (0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111 (0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000 (0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001 (0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010 (0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011 (0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100 (0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101 (0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110 (0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111 (0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000 (1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001 (1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010 (1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011 (1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100 (1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101 (1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110 (1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111 (1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000 (1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001 (1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010 (1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011 (1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100 (1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101 (1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110 (1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111 (1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000000 (0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000001 (0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000010 (0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000011 (0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000100 (0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000101 (0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000110 (0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000111 (0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001000 (0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001001 (0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001010 (0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001011 (0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001100 (0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001101 (0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001110 (0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001111 (0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010000 (0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010001 (0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010010 (0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010011 (0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010100 (0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010101 (0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010110 (0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010111 (0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011000 (0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011001 (0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011010 (0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011011 (0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011100 (0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011101 (0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011110 (0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011111 (0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100000 (1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100001 (1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100010 (1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100011 (1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100100 (1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100101 (1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100110 (1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100111 (1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101000 (1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101001 (1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101010 (1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101011 (1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101100 (1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101101 (1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101110 (1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101111 (1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110000 (1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110001 (1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110010 (1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110011 (1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110100 (1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110101 (1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110110 (1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110111 (1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111000 (1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111001 (1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111010 (1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111011 (1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111100 (1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111101 (1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111110 (1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111111 (1)(1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000000 (0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000001 (0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000010 (0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000011 (0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000100 (0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000101 (0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000110 (0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000111 (0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001000 (0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001001 (0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001010 (0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001011 (0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001100 (0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001101 (0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001110 (0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001111 (0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010000 (0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010001 (0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010010 (0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010011 (0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010100 (0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010101 (0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010110 (0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010111 (0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011000 (0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011001 (0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011010 (0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011011 (0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011100 (0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011101 (0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011110 (0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011111 (0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100000 (0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100001 (0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100010 (0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100011 (0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100100 (0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100101 (0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100110 (0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100111 (0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101000 (0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101001 (0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101010 (0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101011 (0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101100 (0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101101 (0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101110 (0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101111 (0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110000 (0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110001 (0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110010 (0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110011 (0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110100 (0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110101 (0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110110 (0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110111 (0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111000 (0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111001 (0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111010 (0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111011 (0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111100 (0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111101 (0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111110 (0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111111 (0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000000 (1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000001 (1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000010 (1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000011 (1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000100 (1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000101 (1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000110 (1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000111 (1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001000 (1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001001 (1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001010 (1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001011 (1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001100 (1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001101 (1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001110 (1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001111 (1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010000 (1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010001 (1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010010 (1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010011 (1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010100 (1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010101 (1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010110 (1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010111 (1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011000 (1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011001 (1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011010 (1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011011 (1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011100 (1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011101 (1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011110 (1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011111 (1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100000 (1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100001 (1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100010 (1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100011 (1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100100 (1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100101 (1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100110 (1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100111 (1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101000 (1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101001 (1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101010 (1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101011 (1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101100 (1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101101 (1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101110 (1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101111 (1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110000 (1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110001 (1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110010 (1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110011 (1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110100 (1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110101 (1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110110 (1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110111 (1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111000 (1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111001 (1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111010 (1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111011 (1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111100 (1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111101 (1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111110 (1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111111 (1)(1)(1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000000 (0)(0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000001 (0)(0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000010 (0)(0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000011 (0)(0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000100 (0)(0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000101 (0)(0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000110 (0)(0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000111 (0)(0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001000 (0)(0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001001 (0)(0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001010 (0)(0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001011 (0)(0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001100 (0)(0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001101 (0)(0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001110 (0)(0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001111 (0)(0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010000 (0)(0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010001 (0)(0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010010 (0)(0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010011 (0)(0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010100 (0)(0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010101 (0)(0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010110 (0)(0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010111 (0)(0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011000 (0)(0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011001 (0)(0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011010 (0)(0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011011 (0)(0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011100 (0)(0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011101 (0)(0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011110 (0)(0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011111 (0)(0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100000 (0)(0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100001 (0)(0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100010 (0)(0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100011 (0)(0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100100 (0)(0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100101 (0)(0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100110 (0)(0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100111 (0)(0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101000 (0)(0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101001 (0)(0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101010 (0)(0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101011 (0)(0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101100 (0)(0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101101 (0)(0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101110 (0)(0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101111 (0)(0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110000 (0)(0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110001 (0)(0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110010 (0)(0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110011 (0)(0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110100 (0)(0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110101 (0)(0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110110 (0)(0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110111 (0)(0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111000 (0)(0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111001 (0)(0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111010 (0)(0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111011 (0)(0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111100 (0)(0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111101 (0)(0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111110 (0)(0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111111 (0)(0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000000 (0)(1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000001 (0)(1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000010 (0)(1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000011 (0)(1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000100 (0)(1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000101 (0)(1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000110 (0)(1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000111 (0)(1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001000 (0)(1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001001 (0)(1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001010 (0)(1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001011 (0)(1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001100 (0)(1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001101 (0)(1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001110 (0)(1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001111 (0)(1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010000 (0)(1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010001 (0)(1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010010 (0)(1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010011 (0)(1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010100 (0)(1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010101 (0)(1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010110 (0)(1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010111 (0)(1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011000 (0)(1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011001 (0)(1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011010 (0)(1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011011 (0)(1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011100 (0)(1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011101 (0)(1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011110 (0)(1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011111 (0)(1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100000 (0)(1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100001 (0)(1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100010 (0)(1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100011 (0)(1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100100 (0)(1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100101 (0)(1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100110 (0)(1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100111 (0)(1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101000 (0)(1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101001 (0)(1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101010 (0)(1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101011 (0)(1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101100 (0)(1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101101 (0)(1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101110 (0)(1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101111 (0)(1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110000 (0)(1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110001 (0)(1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110010 (0)(1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110011 (0)(1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110100 (0)(1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110101 (0)(1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110110 (0)(1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110111 (0)(1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111000 (0)(1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111001 (0)(1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111010 (0)(1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111011 (0)(1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111100 (0)(1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111101 (0)(1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111110 (0)(1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111111 (0)(1)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000000 (1)(0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000001 (1)(0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000010 (1)(0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000011 (1)(0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000100 (1)(0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000101 (1)(0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000110 (1)(0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000111 (1)(0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001000 (1)(0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001001 (1)(0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001010 (1)(0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001011 (1)(0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001100 (1)(0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001101 (1)(0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001110 (1)(0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001111 (1)(0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010000 (1)(0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010001 (1)(0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010010 (1)(0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010011 (1)(0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010100 (1)(0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010101 (1)(0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010110 (1)(0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010111 (1)(0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011000 (1)(0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011001 (1)(0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011010 (1)(0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011011 (1)(0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011100 (1)(0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011101 (1)(0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011110 (1)(0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011111 (1)(0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100000 (1)(0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100001 (1)(0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100010 (1)(0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100011 (1)(0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100100 (1)(0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100101 (1)(0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100110 (1)(0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100111 (1)(0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101000 (1)(0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101001 (1)(0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101010 (1)(0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101011 (1)(0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101100 (1)(0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101101 (1)(0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101110 (1)(0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101111 (1)(0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110000 (1)(0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110001 (1)(0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110010 (1)(0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110011 (1)(0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110100 (1)(0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110101 (1)(0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110110 (1)(0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110111 (1)(0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111000 (1)(0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111001 (1)(0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111010 (1)(0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111011 (1)(0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111100 (1)(0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111101 (1)(0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111110 (1)(0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111111 (1)(0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000000 (1)(1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000001 (1)(1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000010 (1)(1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000011 (1)(1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000100 (1)(1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000101 (1)(1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000110 (1)(1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000111 (1)(1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001000 (1)(1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001001 (1)(1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001010 (1)(1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001011 (1)(1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001100 (1)(1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001101 (1)(1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001110 (1)(1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001111 (1)(1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010000 (1)(1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010001 (1)(1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010010 (1)(1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010011 (1)(1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010100 (1)(1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010101 (1)(1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010110 (1)(1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010111 (1)(1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011000 (1)(1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011001 (1)(1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011010 (1)(1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011011 (1)(1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011100 (1)(1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011101 (1)(1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011110 (1)(1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011111 (1)(1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100000 (1)(1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100001 (1)(1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100010 (1)(1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100011 (1)(1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100100 (1)(1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100101 (1)(1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100110 (1)(1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100111 (1)(1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101000 (1)(1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101001 (1)(1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101010 (1)(1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101011 (1)(1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101100 (1)(1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101101 (1)(1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101110 (1)(1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101111 (1)(1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110000 (1)(1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110001 (1)(1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110010 (1)(1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110011 (1)(1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110100 (1)(1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110101 (1)(1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110110 (1)(1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110111 (1)(1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111000 (1)(1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111001 (1)(1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111010 (1)(1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111011 (1)(1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111100 (1)(1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111101 (1)(1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111110 (1)(1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111111 (1)(1)(1)(1)(1)(1)(1)(1), + +#endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 56c84a4..321060c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -15,6 +15,7 @@ test-suite utility [ run ../assert_test.cpp ] [ run ../base_from_member_test.cpp ] [ run ../binary_search_test.cpp ] + [ run ../binary_test.cpp ] [ run ../call_traits_test.cpp : -u ] [ compile-fail ../checked_delete_test.cpp ] [ run ../compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor/static : -u ] diff --git a/utility.htm b/utility.htm index 9514188..eff847d 100644 --- a/utility.htm +++ b/utility.htm @@ -23,6 +23,8 @@

  • Function template addressof()
  • Class template result_of
  • +
  • + Macro BOOST_BINARY
  • Other utilities not part of utility.hpp
  • @@ -181,9 +183,63 @@ void f() {

    Class templates for the Base-from-Member Idiom

    See separate documentation.

    +

    Macro BOOST_BINARY

    + +

    The macro BOOST_BINARY is used for the + representation of binary literals. It takes as an argument + a binary number arranged as an arbitrary amount of 1s and 0s in + groupings of length 1 to 8, with groups separated + by spaces. The type of the literal yielded is determined by + the same rules as those of hex and octal + literals (2.13.1p1). By implementation, this macro + expands directly to an octal literal during preprocessing, so + there is no overhead at runtime and the result is useable in + any place that an octal literal would be.

    + +

    In order to directly support binary literals with suffixes, + additional macros of the form BOOST_BINARY_XXX are also + provided, where XXX is a standard integer suffix in all capital + letters. In addition, LL and ULL suffixes may be used for representing + long long and unsigned long long types in compilers which provide + them as an extension.

    + + +

    The BOOST_BINARY family of macros resides in the header + <boost/utility/binary.hpp> + which is automatically included by + <boost/utility.hpp>. + +

    Contributed by Matt Calabrese.

    +

    Example

    +
    +
    +void foo( int );
    +
    +void foo( unsigned long );
    +
    +void bar()
    +{
    +  int value1 = BOOST_BINARY( 100 111000 01 1 110 );
    +
    +  unsigned long value2 = BOOST_BINARY_UL( 100 001 ); // unsigned long
    +
    +  long long value3 = BOOST_BINARY_LL( 11 000 ); // long long if supported
    +
    +  assert(    BOOST_BINARY( 10010 )
    +          &  BOOST_BINARY( 11000 )
    +          == BOOST_BINARY( 10000 )
    +        );
    +
    +  foo( BOOST_BINARY( 1010 ) ); // calls the first foo
    +
    +  foo( BOOST_BINARY_LU( 1010 ) ); // calls the second foo
    +}
    +

    Revised  07 November, 200704 September, 2008

    © Copyright Beman Dawes 1999-2003.

    @@ -191,4 +247,4 @@ void f() { www.boost.org/LICENSE_1_0.txt

    - \ No newline at end of file + From d0ee9a7c28ae8a33701d89d67b84c47e19fb9ea9 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Fri, 19 Sep 2008 20:29:26 +0000 Subject: [PATCH 32/34] Boost Exception major refactoring: works with or without RTTI, vastly improved boost::throw_exception integration. [SVN r48905] --- include/boost/exception.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/boost/exception.hpp b/include/boost/exception.hpp index d805002..c77f215 100644 --- a/include/boost/exception.hpp +++ b/include/boost/exception.hpp @@ -7,13 +7,11 @@ #define UUID_1D94A7C6054E11DB9804B622A1EF5492 #include -#include -#include #include #include +#include #include #include #include -#include #endif From e1991374ae1af1b4b3f7e5218305f8c9d8f46b8f Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 10 Oct 2008 09:29:21 +0000 Subject: [PATCH 33/34] Merge quickbook workaround and fix some links. Merged revisions 48987,49230-49231 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r48987 | danieljames | 2008-09-28 13:21:39 +0100 (Sun, 28 Sep 2008) | 1 line Clean up some link errors. ........ r49230 | danieljames | 2008-10-09 23:13:48 +0100 (Thu, 09 Oct 2008) | 1 line position_iterator is meant to be a forward iterator, so avoid using operator+ with it. ........ r49231 | danieljames | 2008-10-09 23:14:14 +0100 (Thu, 09 Oct 2008) | 4 lines Work around the problems with window newlines in position_iterator. (I'm about to fix them, but this will get quickbook working immediately). Fixes #2155 ........ [SVN r49242] --- operators.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operators.htm b/operators.htm index 13d0d0b..cfe77da 100644 --- a/operators.htm +++ b/operators.htm @@ -2022,7 +2022,7 @@ public: -

    Check the compiler status +

    Check the compiler status report for the test results with selected platforms.


    From 9168cb9c617bb9e274590a2022630778ee65584c Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Mon, 13 Oct 2008 19:21:03 +0000 Subject: [PATCH 34/34] CodeGear patch. Fixes #2341 [SVN r49319] --- include/boost/detail/call_traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/detail/call_traits.hpp b/include/boost/detail/call_traits.hpp index 54d441c..6ad646e 100644 --- a/include/boost/detail/call_traits.hpp +++ b/include/boost/detail/call_traits.hpp @@ -92,7 +92,7 @@ struct call_traits typedef T& param_type; // hh removed const }; -#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 ) ) +#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 ) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified