Permalink
Browse files

Merge remote-tracking branch 'svngithub/trunk' into pristine-trunk

  • Loading branch information...
2 parents 2dea12d + fcfba33 commit 0c24d7f511cdd9b3bda192c24ac22c2bd3bd640a @denisarnaud denisarnaud committed Jan 11, 2013
Showing with 8,093 additions and 4,693 deletions.
  1. +1 −1 Jamroot
  2. +40 −3 boost/accumulators/framework/depends_on.hpp
  3. +1 −1 boost/accumulators/statistics/density.hpp
  4. +3 −3 boost/algorithm/cxx11/copy_if.hpp
  5. +4 −4 boost/algorithm/cxx11/is_permutation.hpp
  6. +17 −13 boost/algorithm/hex.hpp
  7. +4 −2 boost/algorithm/minmax_element.hpp
  8. +2 −2 boost/algorithm/searching/boyer_moore.hpp
  9. +5 −0 boost/algorithm/searching/boyer_moore_horspool.hpp
  10. +5 −0 boost/algorithm/searching/knuth_morris_pratt.hpp
  11. +3 −3 boost/algorithm/string/detail/find_format.hpp
  12. +2 −2 boost/algorithm/string/detail/find_format_all.hpp
  13. +4 −1 boost/algorithm/string/find_iterator.hpp
  14. +6 −4 boost/archive/archive_exception.hpp
  15. +8 −10 boost/archive/impl/basic_text_iprimitive.ipp
  16. +1 −1 boost/archive/impl/basic_text_oprimitive.ipp
  17. +1 −1 boost/archive/iterators/binary_from_base64.hpp
  18. +18 −6 boost/archive/iterators/istream_iterator.hpp
  19. +70 −68 boost/archive/iterators/transform_width.hpp
  20. +29 −0 boost/array.hpp
  21. +3 −3 boost/asio/impl/error.ipp
  22. +4 −157 boost/atomic.hpp
  23. +205 −0 boost/atomic/atomic.hpp
  24. +22 −15 boost/atomic/detail/base.hpp
  25. +25 −19 boost/atomic/detail/cas32strong.hpp
  26. +25 −18 boost/atomic/detail/cas32weak.hpp
  27. +14 −8 boost/atomic/detail/cas64strong.hpp
  28. +54 −0 boost/atomic/detail/config.hpp
  29. +7 −2 boost/atomic/detail/gcc-alpha.hpp
  30. +0 −241 boost/atomic/detail/gcc-armv6+.hpp
  31. +250 −0 boost/atomic/detail/gcc-armv6plus.hpp
  32. +14 −6 boost/atomic/detail/gcc-cas.hpp
  33. +47 −35 boost/atomic/detail/gcc-ppc.hpp
  34. +41 −29 boost/atomic/detail/gcc-sparcv9.hpp
  35. +232 −161 boost/atomic/detail/gcc-x86.hpp
  36. +16 −11 boost/atomic/detail/generic-cas.hpp
  37. +185 −133 boost/atomic/detail/interlocked.hpp
  38. +17 −10 boost/atomic/detail/linux-arm.hpp
  39. +36 −28 boost/atomic/detail/lockpool.hpp
  40. +62 −0 boost/atomic/detail/platform.hpp
  41. +45 −0 boost/atomic/detail/type-classification.hpp
  42. +0 −81 boost/atomic/detail/type-classifier.hpp
  43. +1,441 −0 boost/atomic/detail/windows.hpp
  44. +0 −53 boost/atomic/platform.hpp
  45. +33 −22 boost/bimap/bimap.hpp
  46. +12 −4 boost/bimap/container_adaptor/vector_adaptor.hpp
  47. +1 −44 boost/bimap/detail/bimap_core.hpp
  48. +27 −36 boost/bimap/detail/map_view_base.hpp
  49. +232 −95 boost/bimap/detail/map_view_iterator.hpp
  50. +2 −2 boost/bimap/detail/set_view_base.hpp
  51. +4 −4 boost/bimap/detail/set_view_iterator.hpp
  52. +47 −3 boost/bimap/relation/mutant_relation.hpp
  53. +44 −0 boost/bimap/relation/structured_pair.hpp
  54. +18 −104 boost/bimap/support/iterator_type_by.hpp
  55. +10 −15 boost/bimap/views/list_map_view.hpp
  56. +2 −2 boost/bimap/views/map_view.hpp
  57. +2 −2 boost/bimap/views/multimap_view.hpp
  58. +2 −0 boost/bimap/views/unconstrained_map_view.hpp
  59. +2 −2 boost/bimap/views/unordered_map_view.hpp
  60. +2 −2 boost/bimap/views/unordered_multimap_view.hpp
  61. +37 −3 boost/bimap/views/vector_map_view.hpp
  62. +34 −0 boost/bimap/views/vector_set_view.hpp
  63. +10 −2 boost/chrono/chrono_io.hpp
  64. +48 −1 boost/chrono/config.hpp
  65. +10 −0 boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp
  66. +12 −13 boost/chrono/duration.hpp
  67. +22 −26 boost/chrono/io/duration_io.hpp
  68. +3 −2 boost/chrono/io/ios_base_state.hpp
  69. +392 −48 boost/chrono/io/time_point_io.hpp
  70. +4 −4 boost/chrono/io/utility/ios_base_state_ptr.hpp
  71. +1 −2 boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp
  72. +1 −0 boost/chrono/stopwatches/formatters/base_formatter.hpp
  73. +1 −2 boost/chrono/stopwatches/formatters/elapsed_formatter.hpp
  74. +2 −2 boost/chrono/time_point.hpp
  75. +9 −0 boost/config/compiler/clang.hpp
  76. +7 −1 boost/config/compiler/gcc.hpp
  77. +9 −2 boost/config/stdlib/dinkumware.hpp
  78. +30 −18 boost/config/suffix.hpp
  79. +23 −23 boost/container/allocator_traits.hpp
  80. +26 −26 boost/container/container_fwd.hpp
  81. +771 −770 boost/container/deque.hpp
  82. +470 −245 boost/container/detail/adaptive_node_pool_impl.hpp
  83. +201 −290 boost/container/detail/advanced_insert_int.hpp
  84. +163 −0 boost/container/detail/allocator_version_traits.hpp
  85. +114 −2 boost/container/detail/destroyers.hpp
  86. +42 −38 boost/container/detail/flat_tree.hpp
  87. +17 −2 boost/container/detail/iterators.hpp
  88. +97 −65 boost/container/detail/multiallocation_chain.hpp
  89. +55 −142 boost/container/detail/node_alloc_holder.hpp
  90. +16 −16 boost/container/detail/node_pool_impl.hpp
  91. +2 −2 boost/container/detail/pair.hpp
  92. +1 −1 boost/container/detail/pool_common.hpp
  93. +22 −20 boost/container/detail/preprocessor.hpp
  94. +16 −13 boost/container/detail/tree.hpp
  95. +2 −2 boost/container/detail/type_traits.hpp
  96. +349 −50 boost/container/detail/utilities.hpp
  97. +12 −4 boost/container/detail/workaround.hpp
  98. +519 −430 boost/container/flat_map.hpp
  99. +501 −437 boost/container/flat_set.hpp
  100. +633 −517 boost/container/list.hpp
Sorry, we could not display the entire diff because too many files (4,275) changed.
View
2 Jamroot
@@ -130,7 +130,7 @@ import set ;
import path ;
path-constant BOOST_ROOT : . ;
-constant BOOST_VERSION : 1.52.0 ;
+constant BOOST_VERSION : 1.53.0 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;
boostcpp.set-version $(BOOST_VERSION) ;
View
43 boost/accumulators/framework/depends_on.hpp
@@ -11,6 +11,8 @@
#include <boost/version.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/map.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/copy.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/sort.hpp>
@@ -26,6 +28,7 @@
#include <boost/mpl/is_sequence.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/transform_view.hpp>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
@@ -94,15 +97,49 @@ namespace boost { namespace accumulators
template<typename A, typename B>
struct is_dependent_on
: is_base_and_derived<
- typename undroppable<B>::type
+ typename feature_of<typename undroppable<B>::type>::type
, typename undroppable<A>::type
>
{};
+ template<typename Feature>
+ struct dependencies_of
+ {
+ typedef typename Feature::dependencies type;
+ };
+
+ // Should use mpl::insert_range, but doesn't seem to work with mpl sets
+ template<typename Set, typename Range>
+ struct set_insert_range
+ : mpl::fold<
+ Range
+ , Set
+ , mpl::insert<mpl::_1, mpl::_2>
+ >
+ {};
+
+ template<typename Features>
+ struct collect_abstract_features
+ : mpl::fold<
+ Features
+ , mpl::set0<>
+ , set_insert_range<
+ mpl::insert<mpl::_1, feature_of<mpl::_2> >
+ , collect_abstract_features<dependencies_of<mpl::_2> >
+ >
+ >
+ {};
+
template<typename Features>
struct depends_on_base
: mpl::inherit_linearly<
- typename mpl::sort<Features, is_dependent_on<mpl::_1, mpl::_2> >::type
+ typename mpl::sort<
+ typename mpl::copy<
+ typename collect_abstract_features<Features>::type
+ , mpl::back_inserter<mpl::vector0<> >
+ >::type
+ , is_dependent_on<mpl::_1, mpl::_2>
+ >::type
// Don't inherit multiply from a feature
, mpl::if_<
is_dependent_on<mpl::_1, mpl::_2>
@@ -319,7 +356,7 @@ namespace boost { namespace accumulators
type;
};
- // BUGBUG work around a MPL bug wrt map insertion
+ // BUGBUG work around an MPL bug wrt map insertion
template<typename FeatureMap, typename Feature>
struct insert_feature
: mpl::eval_if<
View
2 boost/accumulators/statistics/density.hpp
@@ -95,7 +95,7 @@ namespace impl
}
// Once cache_size samples have been accumulated, create num_bins bins of same size between
- // the minimum and maximum of the cached samples as well as an under- and and an overflow bin.
+ // the minimum and maximum of the cached samples as well as under and overflow bins.
// Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin).
if (cnt == this->cache_size)
{
View
6 boost/algorithm/cxx11/copy_if.hpp
@@ -39,7 +39,7 @@ OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator
{
for ( ; first != last; ++first )
if (p(*first))
- *result++ = first;
+ *result++ = *first;
return result;
}
#endif
@@ -75,7 +75,7 @@ OutputIterator copy_while ( InputIterator first, InputIterator last,
OutputIterator result, Predicate p )
{
for ( ; first != last && p(*first); ++first )
- *result++ = first;
+ *result++ = *first;
return result;
}
@@ -109,7 +109,7 @@ template<typename InputIterator, typename OutputIterator, typename Predicate>
OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
{
for ( ; first != last && !p(*first); ++first )
- *result++ = first;
+ *result++ = *first;
return result;
}
View
8 boost/algorithm/cxx11/is_permutation.hpp
@@ -46,7 +46,7 @@ namespace detail {
/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2, BinaryPredicate p )
-/// \brief Tests to see if a the sequence [first,last) is a permutation of the sequence starting at first2
+/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2
///
/// \param first The start of the input sequence
/// \param last One past the end of the input sequence
@@ -88,7 +88,7 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
}
/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 )
-/// \brief Tests to see if a the sequence [first,last) is a permutation of the sequence starting at first2
+/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2
///
/// \param first The start of the input sequence
/// \param last One past the end of the input sequence
@@ -108,7 +108,7 @@ bool is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIter
#endif
/// \fn is_permutation ( const Range &r, ForwardIterator first2 )
-/// \brief Tests to see if a the sequence [first,last) is a permutation of the sequence starting at first2
+/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2
///
/// \param r The input range
/// \param first2 The start of the second sequence
@@ -119,7 +119,7 @@ bool is_permutation ( const Range &r, ForwardIterator first2 )
}
/// \fn is_permutation ( const Range &r, ForwardIterator first2, BinaryPredicate pred )
-/// \brief Tests to see if a the sequence [first,last) is a permutation of the sequence starting at first2
+/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2
///
/// \param r The input range
/// \param first2 The start of the second sequence
View
30 boost/algorithm/hex.hpp
@@ -69,14 +69,18 @@ namespace detail {
return std::copy ( res, res + num_hex_digits, out );
}
+// this needs to be in an un-named namespace because it is not a template
+// and might get included in several compilation units. This could cause
+// multiple definition errors at link time.
+ namespace {
unsigned hex_char_to_int ( char c ) {
if ( c >= '0' && c <= '9' ) return c - '0';
if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10;
if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10;
BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c));
- return 0; // keep dumb compilers happy
+ return 0; // keep dumb compilers happy
}
-
+ }
// My own iterator_traits class.
// It is here so that I can "reach inside" some kinds of output iterators
@@ -105,17 +109,17 @@ namespace detail {
// The first one is the output type, the second one is the character type of
// the underlying stream, the third is the character traits.
// We only care about the first one.
- template<typename T, typename charType, typename traits>
- struct hex_iterator_traits< std::ostream_iterator<T, charType, traits> > {
- typedef T value_type;
- };
-
- template <typename Iterator>
- bool iter_end ( Iterator current, Iterator last ) { return current == last; }
-
- template <typename T>
- bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; }
-
+ template<typename T, typename charType, typename traits>
+ struct hex_iterator_traits< std::ostream_iterator<T, charType, traits> > {
+ typedef T value_type;
+ };
+
+ template <typename Iterator>
+ bool iter_end ( Iterator current, Iterator last ) { return current == last; }
+
+ template <typename T>
+ bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; }
+
// What can we assume here about the inputs?
// is std::iterator_traits<InputIterator>::value_type always 'char' ?
// Could it be wchar_t, say? Does it matter?
View
6 boost/algorithm/minmax_element.hpp
@@ -99,8 +99,10 @@ namespace boost {
// if odd number of elements, treat last element
if (first != last) { // odd number of elements
- if (comp(first, min_result))
- min_result = first, potential_min_result = last;
+ if (comp(first, min_result)) {
+ min_result = first;
+ potential_min_result = last;
+ }
else if (comp(max_result, first))
max_result = first;
}
View
4 boost/algorithm/searching/boyer_moore.hpp
@@ -33,8 +33,8 @@ namespace boost { namespace algorithm {
http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/
http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf
-Explanations: boostinspect:noascii (test tool complains)
- http://en.wikipedia.org/wiki/Boyer–Moore_string_search_algorithm
+Explanations:
+ http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm
http://www.movsd.com/bm.htm
http://www.cs.ucdavis.edu/~gusfield/cs224f09/bnotes.pdf
View
5 boost/algorithm/searching/boyer_moore_horspool.hpp
@@ -14,6 +14,11 @@
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
+
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+
+#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/algorithm/searching/detail/bm_traits.hpp>
View
5 boost/algorithm/searching/knuth_morris_pratt.hpp
@@ -15,6 +15,11 @@
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
+
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+
+#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/algorithm/searching/detail/debugging.hpp>
View
6 boost/algorithm/string/detail/find_format.hpp
@@ -118,11 +118,11 @@ namespace boost {
InputT Output;
// Copy the beginning of the sequence
- insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() );
+ boost::algorithm::detail::insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() );
// Copy formated result
- insert( Output, ::boost::end(Output), M.format_result() );
+ boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
// Copy the rest of the sequence
- insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) );
+ boost::algorithm::detail::insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) );
return Output;
}
View
4 boost/algorithm/string/detail/find_format_all.hpp
@@ -134,9 +134,9 @@ namespace boost {
while( M )
{
// Copy the beginning of the sequence
- insert( Output, ::boost::end(Output), LastMatch, M.begin() );
+ boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, M.begin() );
// Copy formated result
- insert( Output, ::boost::end(Output), M.format_result() );
+ boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
// Proceed to the next match
LastMatch=M.end();
View
5 boost/algorithm/string/find_iterator.hpp
@@ -132,7 +132,10 @@ namespace boost {
// increment
void increment()
{
- m_Match=this->do_find(m_Match.end(),m_End);
+ if(m_Match.begin() == m_Match.end())
+ m_Match=this->do_find(m_Match.end(),m_End);
+ else
+ m_Match=this->do_find(m_Match.begin()+1,m_End);
}
// comparison
View
10 boost/archive/archive_exception.hpp
@@ -43,6 +43,8 @@ namespace archive {
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception :
public virtual std::exception
{
+protected:
+ char m_buffer[128];
public:
typedef enum {
no_exception, // initialized without code
@@ -74,18 +76,18 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception :
// type has been instantiated in more than one module.
output_stream_error // error on input stream
} exception_code;
-protected:
- std::string m_msg;
public:
exception_code code;
archive_exception(
exception_code c,
const char * e1 = NULL,
const char * e2 = NULL
);
- ~archive_exception() throw ();
- virtual const char *what( ) const throw();
+ virtual ~archive_exception() throw();
+ virtual const char *what() const throw();
protected:
+ unsigned int
+ append(unsigned int l, const char * a);
archive_exception();
};
View
18 boost/archive/impl/basic_text_iprimitive.ipp
@@ -86,23 +86,21 @@ basic_text_iprimitive<IStream>::load_binary(
,CharType
>
binary;
-
- binary ti_begin = binary(
+
+ binary i = binary(
BOOST_MAKE_PFTO_WRAPPER(
iterators::istream_iterator<CharType>(is)
)
);
-
+
char * caddr = static_cast<char *>(address);
// take care that we don't increment anymore than necessary
- while(--count > 0){
- *caddr++ = static_cast<char>(*ti_begin);
- ++ti_begin;
+ while(count-- > 0){
+ *caddr++ = static_cast<char>(*i++);
}
- *caddr++ = static_cast<char>(*ti_begin);
-
- iterators::istream_iterator<CharType> i;
+
+ // skip over any excess input
for(;;){
BOOST_DEDUCED_TYPENAME IStream::int_type r;
r = is.get();
@@ -112,7 +110,7 @@ basic_text_iprimitive<IStream>::load_binary(
break;
}
}
-
+
template<class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_text_iprimitive<IStream>::basic_text_iprimitive(
View
2 boost/archive/impl/basic_text_oprimitive.ipp
@@ -51,7 +51,7 @@ basic_text_oprimitive<OStream>::save_binary(
8
>
>
- ,72
+ ,76
,const char // cwpro8 needs this
>
base64_text;
View
2 boost/archive/iterators/binary_from_base64.hpp
@@ -43,7 +43,7 @@ struct to_6_bit {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
- 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,
+ 52,53,54,55,56,57,58,59,60,61,-1,-1,-1, 0,-1,-1, // render '=' as 0
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
View
24 boost/archive/iterators/istream_iterator.hpp
@@ -49,16 +49,17 @@ class istream_iterator :
> super_t;
typedef BOOST_DEDUCED_TYPENAME std::basic_istream<Elem> istream_type;
- //Access the value referred to
- Elem dereference() const {
- return m_current_value;
- }
-
bool equal(const this_t & rhs) const {
// note: only works for comparison against end of stream
return m_istream == rhs.m_istream;
}
+/*
+ //Access the value referred to
+ Elem dereference() const {
+ return m_current_value;
+ }
+
void increment(){
if(NULL != m_istream){
m_current_value = static_cast<Elem>(m_istream->get());
@@ -67,14 +68,25 @@ class istream_iterator :
}
}
}
+*/
+ //Access the value referred to
+ Elem dereference() const {
+ return m_istream->peek();
+ }
+
+ void increment(){
+ if(NULL != m_istream){
+ m_istream->ignore(1);
+ }
+ }
istream_type *m_istream;
Elem m_current_value;
public:
istream_iterator(istream_type & is) :
m_istream(& is)
{
- increment();
+ //increment();
}
istream_iterator() :
View
138 boost/archive/iterators/transform_width.hpp
@@ -24,8 +24,6 @@
// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters
// or 3 8 bit characters
-#include <algorithm>
-
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO
#include <boost/serialization/pfto.hpp>
@@ -66,101 +64,105 @@ class transform_width :
typedef transform_width<Base, BitsOut, BitsIn, CharType> this_t;
typedef BOOST_DEDUCED_TYPENAME iterator_value<Base>::type base_value_type;
- CharType fill();
+ void fill();
- CharType dereference_impl(){
- if(! m_full){
- m_current_value = fill();
- m_full = true;
- }
- return m_current_value;
+ CharType dereference() const {
+ if(!m_buffer_out_full)
+ const_cast<this_t *>(this)->fill();
+ return m_buffer_out;
}
- CharType dereference() const {
- return const_cast<this_t *>(this)->dereference_impl();
+ bool equal_impl(const this_t & rhs){
+ if(BitsIn < BitsOut) // discard any left over bits
+ return this->base_reference() == rhs.base_reference();
+ else{
+ // BitsIn > BitsOut // zero fill
+ if(this->base_reference() == rhs.base_reference()){
+ m_end_of_sequence = true;
+ return 0 == m_remaining_bits;
+ }
+ return false;
+ }
}
- // test for iterator equality
+ // standard iterator interface
bool equal(const this_t & rhs) const {
- return
- this->base_reference() == rhs.base_reference();
- ;
+ return const_cast<this_t *>(this)->equal_impl(rhs);
}
void increment(){
- m_displacement += BitsOut;
-
- while(m_displacement >= BitsIn){
- m_displacement -= BitsIn;
- if(0 == m_displacement)
- m_bufferfull = false;
- if(! m_bufferfull){
- // note: suspect that this is not invoked for borland
- ++(this->base_reference());
- }
- }
- m_full = false;
+ m_buffer_out_full = false;
}
- CharType m_current_value;
- // number of bits left in current input character buffer
- unsigned int m_displacement;
- base_value_type m_buffer;
- // flag to current output character is ready - just used to save time
- bool m_full;
- // flag to indicate that m_buffer has data
- bool m_bufferfull;
+ bool m_buffer_out_full;
+ CharType m_buffer_out;
+
+ // last read element from input
+ base_value_type m_buffer_in;
+
+ // number of bits to left in the input buffer.
+ unsigned int m_remaining_bits;
+
+ // flag to indicate we've reached end of data.
+ bool m_end_of_sequence;
public:
// make composible buy using templated constructor
template<class T>
transform_width(BOOST_PFTO_WRAPPER(T) start) :
super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))),
- m_displacement(0),
- m_full(false),
- m_bufferfull(false)
+ m_buffer_out_full(false),
+ m_remaining_bits(0),
+ m_end_of_sequence(false)
{}
// intel 7.1 doesn't like default copy constructor
transform_width(const transform_width & rhs) :
super_t(rhs.base_reference()),
- m_current_value(rhs.m_current_value),
- m_displacement(rhs.m_displacement),
- m_buffer(rhs.m_buffer),
- m_full(rhs.m_full),
- m_bufferfull(rhs.m_bufferfull)
+ m_buffer_out_full(rhs.m_buffer_out_full),
+ m_remaining_bits(rhs.m_remaining_bits),
+ m_buffer_in(rhs.m_buffer_in),
+ m_end_of_sequence(false)
{}
};
-template<class Base, int BitsOut, int BitsIn, class CharType>
-CharType transform_width<Base, BitsOut, BitsIn, CharType>::fill(){
- CharType retval = 0;
+template<
+ class Base,
+ int BitsOut,
+ int BitsIn,
+ class CharType
+>
+void transform_width<Base, BitsOut, BitsIn, CharType>::fill() {
unsigned int missing_bits = BitsOut;
- for(;;){
- unsigned int bcount;
- if(! m_bufferfull){
- m_buffer = * this->base_reference();
- m_bufferfull = true;
- bcount = BitsIn;
+ m_buffer_out = 0;
+ do{
+ if(0 == m_remaining_bits){
+ if(m_end_of_sequence){
+ m_buffer_in = 0;
+ m_remaining_bits = missing_bits;
+ }
+ else{
+ m_buffer_in = * this->base_reference()++;
+ m_remaining_bits = BitsIn;
+ }
}
- else
- bcount = BitsIn - m_displacement;
- unsigned int i = (std::min)(bcount, missing_bits);
+
+ // append these bits to the next output
+ // up to the size of the output
+ unsigned int i = std::min(missing_bits, m_remaining_bits);
// shift interesting bits to least significant position
- unsigned int j = m_buffer >> (bcount - i);
- // strip off uninteresting bits
- // (note presumption of two's complement arithmetic)
- j &= ~(-(1 << i));
+ base_value_type j = m_buffer_in >> (m_remaining_bits - i);
+ // and mask off the un interesting higher bits
+ // note presumption of twos complement notation
+ j &= (1 << i) - 1;
// append then interesting bits to the output value
- retval <<= i;
- retval |= j;
+ m_buffer_out <<= i;
+ m_buffer_out |= j;
+
+ // and update counters
missing_bits -= i;
- if(0 == missing_bits)
- break;
- // note: suspect that this is not invoked for borland 5.51
- ++(this->base_reference());
- m_bufferfull = false;
- }
- return retval;
+ m_remaining_bits -= i;
+ }while(0 < missing_bits);
+ m_buffer_out_full = true;
}
} // namespace iterators
View
29 boost/array.hpp
@@ -42,6 +42,7 @@
#include <cstddef>
#include <stdexcept>
#include <boost/assert.hpp>
+#include <boost/static_assert.hpp>
#include <boost/swap.hpp>
// Handles broken standard libraries better than <iterator>
@@ -436,8 +437,36 @@ namespace boost {
return boost::hash_range(arr.begin(), arr.end());
}
+ template <size_t Idx, typename T, size_t N>
+ T &get(boost::array<T,N> &arr) BOOST_NOEXCEPT {
+ BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" );
+ return arr[Idx];
+ }
+
+ template <size_t Idx, typename T, size_t N>
+ const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
+ BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" );
+ return arr[Idx];
+ }
+
} /* namespace boost */
+#ifndef BOOST_NO_CXX11_HDR_ARRAY
+// If we don't have std::array, I'm assuming that we don't have std::get
+namespace std {
+ template <size_t Idx, typename T, size_t N>
+ T &get(boost::array<T,N> &arr) BOOST_NOEXCEPT {
+ BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" );
+ return arr[Idx];
+ }
+
+ template <size_t Idx, typename T, size_t N>
+ const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
+ BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" );
+ return arr[Idx];
+ }
+}
+#endif
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)
View
6 boost/asio/impl/error.ipp
@@ -31,7 +31,7 @@ namespace detail {
class netdb_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_SYSTEM_NOEXCEPT
{
return "asio.netdb";
}
@@ -63,7 +63,7 @@ namespace detail {
class addrinfo_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_SYSTEM_NOEXCEPT
{
return "asio.addrinfo";
}
@@ -93,7 +93,7 @@ namespace detail {
class misc_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_SYSTEM_NOEXCEPT
{
return "asio.misc";
}
View
161 boost/atomic.hpp
@@ -7,165 +7,12 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <cstddef>
-#include <boost/cstdint.hpp>
+// This header includes all Boost.Atomic public headers
-#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
-#include <boost/atomic/platform.hpp>
-#include <boost/atomic/detail/type-classifier.hpp>
-#include <boost/type_traits/is_signed.hpp>
-
-namespace boost {
-
-#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE
-#define BOOST_ATOMIC_CHAR_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE
-#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE
-#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE
-#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE
-#define BOOST_ATOMIC_SHORT_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_INT_LOCK_FREE
-#define BOOST_ATOMIC_INT_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_LONG_LOCK_FREE
-#define BOOST_ATOMIC_LONG_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE
-#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE
-#define BOOST_ATOMIC_POINTER_LOCK_FREE 0
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
#endif
-#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE
-
-#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE
-#define BOOST_ATOMIC_BOOL_LOCK_FREE 0
-#endif
-
-#ifndef BOOST_ATOMIC_THREAD_FENCE
-#define BOOST_ATOMIC_THREAD_FENCE 0
-static inline void
-atomic_thread_fence(memory_order)
-{
-}
-#endif
-
-#ifndef BOOST_ATOMIC_SIGNAL_FENCE
-#define BOOST_ATOMIC_SIGNAL_FENCE 0
-static inline void
-atomic_signal_fence(memory_order order)
-{
- atomic_thread_fence(order);
-}
-#endif
-
-template<typename T>
-class atomic : public atomics::detail::base_atomic<T, typename atomics::detail::type_classifier<T>::test, sizeof(T), boost::is_signed<T>::value > {
-private:
- typedef T value_type;
- typedef atomics::detail::base_atomic<T, typename atomics::detail::type_classifier<T>::test, sizeof(T), boost::is_signed<T>::value > super;
-public:
- atomic(void) : super() {}
- explicit atomic(const value_type & v) : super(v) {}
-
- atomic & operator=(value_type v) volatile
- {
- super::operator=(v);
- return *const_cast<atomic *>(this);
- }
-private:
- atomic(const atomic &) /* =delete */ ;
- atomic & operator=(const atomic &) /* =delete */ ;
-};
-
-typedef atomic<char> atomic_char;
-typedef atomic<unsigned char> atomic_uchar;
-typedef atomic<signed char> atomic_schar;
-typedef atomic<uint8_t> atomic_uint8_t;
-typedef atomic<int8_t> atomic_int8_t;
-typedef atomic<unsigned short> atomic_ushort;
-typedef atomic<short> atomic_short;
-typedef atomic<uint16_t> atomic_uint16_t;
-typedef atomic<int16_t> atomic_int16_t;
-typedef atomic<unsigned int> atomic_uint;
-typedef atomic<int> atomic_int;
-typedef atomic<uint32_t> atomic_uint32_t;
-typedef atomic<int32_t> atomic_int32_t;
-typedef atomic<unsigned long> atomic_ulong;
-typedef atomic<long> atomic_long;
-typedef atomic<uint64_t> atomic_uint64_t;
-typedef atomic<int64_t> atomic_int64_t;
-#ifdef BOOST_HAS_LONG_LONG
-typedef atomic<unsigned long long> atomic_ullong;
-typedef atomic<long long> atomic_llong;
-#endif
-typedef atomic<void*> atomic_address;
-typedef atomic<bool> atomic_bool;
-
-#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE
-#define BOOST_ATOMIC_FLAG_LOCK_FREE 0
-class atomic_flag {
-public:
- atomic_flag(void) : v_(false) {}
-
- bool
- test_and_set(memory_order order = memory_order_seq_cst)
- {
- return v_.exchange(true, order);
- }
-
- void
- clear(memory_order order = memory_order_seq_cst) volatile
- {
- v_.store(false, order);
- }
-private:
- atomic_flag(const atomic_flag &) /* = delete */ ;
- atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
- atomic<bool> v_;
-};
-#endif
-
-typedef atomic<char> atomic_char;
-typedef atomic<unsigned char> atomic_uchar;
-typedef atomic<signed char> atomic_schar;
-typedef atomic<uint8_t> atomic_uint8_t;
-typedef atomic<int8_t> atomic_int8_t;
-typedef atomic<unsigned short> atomic_ushort;
-typedef atomic<short> atomic_short;
-typedef atomic<uint16_t> atomic_uint16_t;
-typedef atomic<int16_t> atomic_int16_t;
-typedef atomic<unsigned int> atomic_uint;
-typedef atomic<int> atomic_int;
-typedef atomic<uint32_t> atomic_uint32_t;
-typedef atomic<int32_t> atomic_int32_t;
-typedef atomic<unsigned long> atomic_ulong;
-typedef atomic<long> atomic_long;
-typedef atomic<uint64_t> atomic_uint64_t;
-typedef atomic<int64_t> atomic_int64_t;
-typedef atomic<unsigned long long> atomic_ullong;
-typedef atomic<long long> atomic_llong;
-typedef atomic<void*> atomic_address;
-typedef atomic<bool> atomic_bool;
-
-}
-
#endif
View
205 boost/atomic/atomic.hpp
@@ -0,0 +1,205 @@
+#ifndef BOOST_ATOMIC_ATOMIC_HPP
+#define BOOST_ATOMIC_ATOMIC_HPP
+
+// Copyright (c) 2011 Helge Bahmann
+//
+// 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 <cstddef>
+#include <boost/cstdint.hpp>
+
+#include <boost/memory_order.hpp>
+
+#include <boost/atomic/detail/config.hpp>
+#include <boost/atomic/detail/platform.hpp>
+#include <boost/atomic/detail/type-classification.hpp>
+#include <boost/type_traits/is_signed.hpp>
+
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE
+#define BOOST_ATOMIC_CHAR_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE
+#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE
+#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE
+#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE
+#define BOOST_ATOMIC_SHORT_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_INT_LOCK_FREE
+#define BOOST_ATOMIC_INT_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_LONG_LOCK_FREE
+#define BOOST_ATOMIC_LONG_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE
+#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE
+#define BOOST_ATOMIC_POINTER_LOCK_FREE 0
+#endif
+
+#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE
+
+#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE
+#define BOOST_ATOMIC_BOOL_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_THREAD_FENCE
+#define BOOST_ATOMIC_THREAD_FENCE 0
+inline void atomic_thread_fence(memory_order)
+{
+}
+#endif
+
+#ifndef BOOST_ATOMIC_SIGNAL_FENCE
+#define BOOST_ATOMIC_SIGNAL_FENCE 0
+inline void atomic_signal_fence(memory_order order)
+{
+ atomic_thread_fence(order);
+}
+#endif
+
+template<typename T>
+class atomic :
+ public atomics::detail::base_atomic<T, typename atomics::detail::classify<T>::type, atomics::detail::storage_size_of<T>::value, boost::is_signed<T>::value >
+{
+private:
+ typedef T value_type;
+ typedef atomics::detail::base_atomic<T, typename atomics::detail::classify<T>::type, atomics::detail::storage_size_of<T>::value, boost::is_signed<T>::value > super;
+public:
+ atomic(void) : super() {}
+ explicit atomic(const value_type & v) : super(v) {}
+
+ atomic & operator=(value_type v) volatile
+ {
+ super::operator=(v);
+ return *const_cast<atomic *>(this);
+ }
+private:
+ atomic(const atomic &) /* =delete */ ;
+ atomic & operator=(const atomic &) /* =delete */ ;
+};
+
+typedef atomic<char> atomic_char;
+typedef atomic<unsigned char> atomic_uchar;
+typedef atomic<signed char> atomic_schar;
+typedef atomic<uint8_t> atomic_uint8_t;
+typedef atomic<int8_t> atomic_int8_t;
+typedef atomic<unsigned short> atomic_ushort;
+typedef atomic<short> atomic_short;
+typedef atomic<uint16_t> atomic_uint16_t;
+typedef atomic<int16_t> atomic_int16_t;
+typedef atomic<unsigned int> atomic_uint;
+typedef atomic<int> atomic_int;
+typedef atomic<uint32_t> atomic_uint32_t;
+typedef atomic<int32_t> atomic_int32_t;
+typedef atomic<unsigned long> atomic_ulong;
+typedef atomic<long> atomic_long;
+typedef atomic<uint64_t> atomic_uint64_t;
+typedef atomic<int64_t> atomic_int64_t;
+#ifdef BOOST_HAS_LONG_LONG
+typedef atomic<boost::ulong_long_type> atomic_ullong;
+typedef atomic<boost::long_long_type> atomic_llong;
+#endif
+typedef atomic<void*> atomic_address;
+typedef atomic<bool> atomic_bool;
+typedef atomic<wchar_t> atomic_wchar_t;
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+typedef atomic<char16_t> atomic_char16_t;
+#endif
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+typedef atomic<char32_t> atomic_char32_t;
+#endif
+
+typedef atomic<int_least8_t> atomic_int_least8_t;
+typedef atomic<uint_least8_t> atomic_uint_least8_t;
+typedef atomic<int_least16_t> atomic_int_least16_t;
+typedef atomic<uint_least16_t> atomic_uint_least16_t;
+typedef atomic<int_least32_t> atomic_int_least32_t;
+typedef atomic<uint_least32_t> atomic_uint_least32_t;
+typedef atomic<int_least64_t> atomic_int_least64_t;
+typedef atomic<uint_least64_t> atomic_uint_least64_t;
+typedef atomic<int_fast8_t> atomic_int_fast8_t;
+typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
+typedef atomic<int_fast16_t> atomic_int_fast16_t;
+typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+typedef atomic<int_fast32_t> atomic_int_fast32_t;
+typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+typedef atomic<int_fast64_t> atomic_int_fast64_t;
+typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+typedef atomic<intmax_t> atomic_intmax_t;
+typedef atomic<uintmax_t> atomic_uintmax_t;
+
+typedef atomic<std::size_t> atomic_size_t;
+typedef atomic<std::ptrdiff_t> atomic_ptrdiff_t;
+
+// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config.
+#if !defined(__PGIC__)
+
+#if defined(BOOST_WINDOWS) \
+ || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0)) \
+ || defined(__CYGWIN__) \
+ || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
+ || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+typedef atomic<intptr_t> atomic_intptr_t;
+typedef atomic<uintptr_t> atomic_uintptr_t;
+#elif defined(__GNUC__) || defined(__clang__)
+#if defined(__INTPTR_TYPE__)
+typedef atomic< __INTPTR_TYPE__ > atomic_intptr_t;
+#endif
+#if defined(__UINTPTR_TYPE__)
+typedef atomic< __UINTPTR_TYPE__ > atomic_uintptr_t;
+#endif
+#endif
+
+#endif
+
+#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE
+#define BOOST_ATOMIC_FLAG_LOCK_FREE 0
+class atomic_flag
+{
+public:
+ atomic_flag(void) : v_(false) {}
+
+ bool
+ test_and_set(memory_order order = memory_order_seq_cst)
+ {
+ return v_.exchange(true, order);
+ }
+
+ void
+ clear(memory_order order = memory_order_seq_cst) volatile
+ {
+ v_.store(false, order);
+ }
+private:
+ atomic_flag(const atomic_flag &) /* = delete */ ;
+ atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
+ atomic<bool> v_;
+};
+#endif
+
+}
+
+#endif
View
37 boost/atomic/detail/base.hpp
@@ -13,8 +13,15 @@
#include <string.h>
+#include <cstddef>
+#include <boost/cstdint.hpp>
+#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/lockpool.hpp>
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
operator value_type(void) volatile const \
{ \
@@ -116,7 +123,7 @@ namespace boost {
namespace atomics {
namespace detail {
-static inline memory_order
+inline memory_order
calculate_failure_order(memory_order order)
{
switch(order) {
@@ -129,7 +136,7 @@ calculate_failure_order(memory_order order)
}
}
-template<typename T, typename C , unsigned int Size, bool Sign>
+template<typename T, typename C, unsigned int Size, bool Sign>
class base_atomic {
private:
typedef base_atomic this_type;
@@ -140,15 +147,15 @@ class base_atomic {
explicit base_atomic(const value_type & v)
{
- memcpy(&v_, &v, Size);
+ memcpy(&v_, &v, sizeof(value_type));
}
void
- store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order /*order*/ = memory_order_seq_cst) volatile
{
guard_type guard(const_cast<char *>(v_));
- memcpy(const_cast<char *>(v_), &v, Size);
+ memcpy(const_cast<char *>(v_), &v, sizeof(value_type));
}
value_type
@@ -157,47 +164,47 @@ class base_atomic {
guard_type guard(const_cast<const char *>(v_));
value_type v;
- memcpy(&v, const_cast<const char *>(v_), Size);
+ memcpy(&v, const_cast<const char *>(v_), sizeof(value_type));
return v;
}
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order /*success_order*/,
memory_order /*failure_order*/) volatile
{
guard_type guard(const_cast<char *>(v_));
- if (memcmp(const_cast<char *>(v_), &expected, Size) == 0) {
- memcpy(const_cast<char *>(v_), &desired, Size);
+ if (memcmp(const_cast<char *>(v_), &expected, sizeof(value_type)) == 0) {
+ memcpy(const_cast<char *>(v_), &desired, sizeof(value_type));
return true;
} else {
- memcpy(&expected, const_cast<char *>(v_), Size);
+ memcpy(&expected, const_cast<char *>(v_), sizeof(value_type));
return false;
}
}
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
return compare_exchange_strong(expected, desired, success_order, failure_order);
}
value_type
- exchange(value_type v, memory_order /*order*/=memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order /*order*/=memory_order_seq_cst) volatile
{
guard_type guard(const_cast<char *>(v_));
value_type tmp;
- memcpy(&tmp, const_cast<char *>(v_), Size);
+ memcpy(&tmp, const_cast<char *>(v_), sizeof(value_type));
- memcpy(const_cast<char *>(v_), &v, Size);
+ memcpy(const_cast<char *>(v_), &v, sizeof(value_type));
return tmp;
}
@@ -212,7 +219,7 @@ class base_atomic {
base_atomic(const base_atomic &) /* = delete */ ;
void operator=(const base_atomic &) /* = delete */ ;
- char v_[Size];
+ char v_[sizeof(value_type)];
};
template<typename T, unsigned int Size, bool Sign>
View
44 boost/atomic/detail/cas32strong.hpp
@@ -10,9 +10,16 @@
// Build 8-, 16- and 32-bit atomic operations from
// a platform_cmpxchg32_strong primitive.
+#include <cstddef>
+#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
+#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/base.hpp>
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
namespace boost {
namespace atomics {
namespace detail {
@@ -595,14 +602,14 @@ class base_atomic<T, void, 1, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -623,7 +630,7 @@ class base_atomic<T, void, 1, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -634,7 +641,7 @@ class base_atomic<T, void, 1, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -644,11 +651,10 @@ class base_atomic<T, void, 1, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
-
storage_type expected_s = 0, desired_s = 0;
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
@@ -685,14 +691,14 @@ class base_atomic<T, void, 2, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -713,7 +719,7 @@ class base_atomic<T, void, 2, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -724,7 +730,7 @@ class base_atomic<T, void, 2, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -734,7 +740,7 @@ class base_atomic<T, void, 2, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -775,14 +781,14 @@ class base_atomic<T, void, 4, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v) : v_(0)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -803,7 +809,7 @@ class base_atomic<T, void, 4, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -814,7 +820,7 @@ class base_atomic<T, void, 4, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -824,7 +830,7 @@ class base_atomic<T, void, 4, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
View
43 boost/atomic/detail/cas32weak.hpp
@@ -7,9 +7,16 @@
//
// Copyright (c) 2011 Helge Bahmann
+#include <cstddef>
+#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
+#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/base.hpp>
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
namespace boost {
namespace atomics {
namespace detail {
@@ -614,14 +621,14 @@ class base_atomic<T, void, 1, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v) : v_(0)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -642,7 +649,7 @@ class base_atomic<T, void, 1, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -653,7 +660,7 @@ class base_atomic<T, void, 1, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -678,7 +685,7 @@ class base_atomic<T, void, 1, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -712,14 +719,14 @@ class base_atomic<T, void, 2, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v) : v_(0)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -740,7 +747,7 @@ class base_atomic<T, void, 2, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -751,7 +758,7 @@ class base_atomic<T, void, 2, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -776,7 +783,7 @@ class base_atomic<T, void, 2, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -810,14 +817,14 @@ class base_atomic<T, void, 4, Sign> {
typedef T value_type;
typedef uint32_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v) : v_(0)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
storage_type tmp = 0;
memcpy(&tmp, &v, sizeof(value_type));
@@ -838,7 +845,7 @@ class base_atomic<T, void, 4, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -849,7 +856,7 @@ class base_atomic<T, void, 4, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -874,7 +881,7 @@ class base_atomic<T, void, 4, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
View
22 boost/atomic/detail/cas64strong.hpp
@@ -11,9 +11,16 @@
// primitive. It is assumed that 64-bit loads/stores are not
// atomic, so they are funnelled through cmpxchg as well.
+#include <cstddef>
+#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
+#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/base.hpp>
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
namespace boost {
namespace atomics {
namespace detail {
@@ -342,16 +349,16 @@ class base_atomic<T, void, 8, Sign> {
typedef T value_type;
typedef uint64_t storage_type;
public:
- explicit base_atomic(value_type v) : v_(0)
+ explicit base_atomic(value_type const& v) : v_(0)
{
memcpy(&v_, &v, sizeof(value_type));
}
- base_atomic(void) : v_(0) {}
+ base_atomic(void) {}
void
- store(value_type value, memory_order order = memory_order_seq_cst) volatile
+ store(value_type const& value, memory_order order = memory_order_seq_cst) volatile
{
- storage_type value_s;
+ storage_type value_s = 0;
memcpy(&value_s, &value, sizeof(value_s));
platform_fence_before_store(order);
platform_store64(value_s, &v_);
@@ -369,7 +376,7 @@ class base_atomic<T, void, 8, Sign> {
}
value_type
- exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile
{
value_type original = load(memory_order_relaxed);
do {
@@ -380,7 +387,7 @@ class base_atomic<T, void, 8, Sign> {
bool
compare_exchange_weak(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
@@ -390,11 +397,10 @@ class base_atomic<T, void, 8, Sign> {
bool
compare_exchange_strong(
value_type & expected,
- value_type desired,
+ value_type const& desired,
memory_order success_order,
memory_order failure_order) volatile
{
-
storage_type expected_s = 0, desired_s = 0;
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
View
54 boost/atomic/detail/config.hpp
@@ -0,0 +1,54 @@
+#ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP
+#define BOOST_ATOMIC_DETAIL_CONFIG_HPP
+
+// Copyright (c) 2012 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__GNUC__) || defined(BOOST_CLANG) || defined(BOOST_INTEL) || defined(__COMO__) || defined(__DMC__)
+#define BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#endif
+
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Set up dll import/export options
+#if (defined(BOOST_ATOMIC_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \
+ !defined(BOOST_ATOMIC_STATIC_LINK)
+
+#if defined(BOOST_ATOMIC_SOURCE)
+#define BOOST_ATOMIC_DECL BOOST_SYMBOL_EXPORT
+#define BOOST_ATOMIC_BUILD_DLL
+#else
+#define BOOST_ATOMIC_DECL BOOST_SYMBOL_IMPORT
+#endif
+
+#endif // building a shared library
+
+#ifndef BOOST_ATOMIC_DECL
+#define BOOST_ATOMIC_DECL
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Auto library naming
+#if !defined(BOOST_ATOMIC_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \
+ !defined(BOOST_ATOMIC_NO_LIB)
+
+#define BOOST_LIB_NAME boost_atomic
+
+// tell the auto-link code to select a dll when required:
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ATOMIC_DYN_LINK)
+#define BOOST_DYN_LINK
+#endif
+
+#include <boost/config/auto_link.hpp>
+
+#endif // auto-linking disabled
+
+#endif
View
9 boost/atomic/detail/gcc-alpha.hpp
@@ -7,9 +7,14 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/base.hpp>
#include <boost/atomic/detail/builder.hpp>
+#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
/*
Refer to http://h71000.www7.hp.com/doc/82final/5601/5601pro_004.html
(HP OpenVMS systems documentation) and the alpha reference manual.
@@ -44,7 +49,7 @@ namespace boost {
namespace atomics {
namespace detail {
-static inline void fence_before(memory_order order)
+inline void fence_before(memory_order order)
{
switch(order) {
case memory_order_consume:
@@ -56,7 +61,7 @@ static inline void fence_before(memory_order order)
}
}
-static inline void fence_after(memory_order order)
+inline void fence_after(memory_order order)
{
switch(order) {
case memory_order_acquire:
View
241 boost/atomic/detail/gcc-armv6+.hpp
@@ -1,241 +0,0 @@
-#ifndef BOOST_ATOMIC_DETAIL_GCC_ARMV6P_HPP
-#define BOOST_ATOMIC_DETAIL_GCC_ARMV6P_HPP
-
-// 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 (c) 2009 Helge Bahmann
-// Copyright (c) 2009 Phil Endecott
-// ARM Code by Phil Endecott, based on other architectures.
-
-// From the ARM Architecture Reference Manual for architecture v6:
-//
-// LDREX{<cond>} <Rd>, [<Rn>]
-// <Rd> Specifies the destination register for the memory word addressed by <Rd>
-// <Rn> Specifies the register containing the address.
-//
-// STREX{<cond>} <Rd>, <Rm>, [<Rn>]
-// <Rd> Specifies the destination register for the returned status value.
-// 0 if the operation updates memory
-// 1 if the operation fails to update memory
-// <Rm> Specifies the register containing the word to be stored to memory.
-// <Rn> Specifies the register containing the address.
-// Rd must not be the same register as Rm or Rn.
-//
-// ARM v7 is like ARM v6 plus:
-// There are half-word and byte versions of the LDREX and STREX instructions,
-// LDREXH, LDREXB, STREXH and STREXB.
-// There are also double-word versions, LDREXD and STREXD.
-// (Actually it looks like these are available from version 6k onwards.)
-// FIXME these are not yet used; should be mostly a matter of copy-and-paste.
-// I think you can supply an immediate offset to the address.
-//
-// A memory barrier is effected using a "co-processor 15" instruction,
-// though a separate assembler mnemonic is available for it in v7.
-
-namespace boost {
-namespace atomics {
-namespace detail {
-
-// "Thumb 1" is a subset of the ARM instruction set that uses a 16-bit encoding. It
-// doesn't include all instructions and in particular it doesn't include the co-processor
-// instruction used for the memory barrier or the load-locked/store-conditional
-// instructions. So, if we're compiling in "Thumb 1" mode, we need to wrap all of our
-// asm blocks with code to temporarily change to ARM mode.
-//
-// You can only change between ARM and Thumb modes when branching using the bx instruction.
-// bx takes an address specified in a register. The least significant bit of the address
-// indicates the mode, so 1 is added to indicate that the destination code is Thumb.
-// A temporary register is needed for the address and is passed as an argument to these
-// macros. It must be one of the "low" registers accessible to Thumb code, specified
-// usng the "l" attribute in the asm statement.
-//
-// Architecture v7 introduces "Thumb 2", which does include (almost?) all of the ARM
-// instruction set. So in v7 we don't need to change to ARM mode; we can write "universal
-// assembler" which will assemble to Thumb 2 or ARM code as appropriate. The only thing
-// we need to do to make this "universal" assembler mode work is to insert "IT" instructions
-// to annotate the conditional instructions. These are ignored in other modes (e.g. v6),
-// so they can always be present.
-
-#if defined(__thumb__) && !defined(__ARM_ARCH_7A__)
-// FIXME also other v7 variants.
-#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) "adr " #TMPREG ", 1f\n" "bx " #TMPREG "\n" ".arm\n" ".align 4\n" "1: "
-#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) "adr " #TMPREG ", 1f + 1\n" "bx " #TMPREG "\n" ".thumb\n" ".align 2\n" "1: "
-
-#else
-// The tmpreg is wasted in this case, which is non-optimal.
-#define BOOST_ATOMIC_ARM_ASM_START(TMPREG)
-#define BOOST_ATOMIC_ARM_ASM_END(TMPREG)
-#endif
-
-#if defined(__ARM_ARCH_7A__)
-// FIXME ditto.
-#define BOOST_ATOMIC_ARM_DMB "dmb\n"
-#else
-#define BOOST_ATOMIC_ARM_DMB "mcr\tp15, 0, r0, c7, c10, 5\n"
-#endif
-
-static inline void
-arm_barrier(void)
-{
- int brtmp;
- __asm__ __volatile__ (
- BOOST_ATOMIC_ARM_ASM_START(%0)
- BOOST_ATOMIC_ARM_DMB
- BOOST_ATOMIC_ARM_ASM_END(%0)
- : "=&l" (brtmp) :: "memory"
- );
-}
-
-static inline void
-platform_fence_before(memory_order order)
-{
- switch(order) {
- case memory_order_release:
- case memory_order_acq_rel:
- case memory_order_seq_cst:
- arm_barrier();
- case memory_order_consume:
- default:;
- }
-}
-
-static inline void
-platform_fence_after(memory_order order)
-{
- switch(order) {
- case memory_order_acquire:
- case memory_order_acq_rel:
- case memory_order_seq_cst:
- arm_barrier();
- default:;
- }
-}
-
-static inline void
-platform_fence_before_store(memory_order order)
-{
- platform_fence_before(order);
-}
-
-static inline void
-platform_fence_after_store(memory_order order)
-{
- if (order == memory_order_seq_cst)
- arm_barrier();
-}
-
-static inline void
-platform_fence_after_load(memory_order order)
-{
- platform_fence_after(order);
-}
-
-template<typename T>
-bool
-platform_cmpxchg32(T & expected, T desired, volatile T * ptr)
-{
- int success;
- int tmp;
- __asm__ (
- BOOST_ATOMIC_ARM_ASM_START(%2)
- "mov %1, #0\n" // success = 0
- "ldrex %0, %3\n" // expected' = *(&i)
- "teq %0, %4\n" // flags = expected'==expected
- "ittt eq\n"
- "strexeq %2, %5, %3\n" // if (flags.equal) *(&i) = desired, tmp = !OK
- "teqeq %2, #0\n" // if (flags.equal) flags = tmp==0
- "moveq %1, #1\n" // if (flags.equal) success = 1
- BOOST_ATOMIC_ARM_ASM_END(%2)
- : "=&r" (expected), // %0
- "=&r" (success), // %1
- "=&l" (tmp), // %2
- "+Q" (*ptr) // %3
- : "r" (expected), // %4
- "r" (desired) // %5
- : "cc"
- );
- return success;
-}
-
-}
-}
-
-#define BOOST_ATOMIC_THREAD_FENCE 2
-static inline void
-atomic_thread_fence(memory_order order)
-{
- switch(order) {
- case memory_order_acquire:
- case memory_order_release:
- case memory_order_acq_rel:
- case memory_order_seq_cst:
- atomics::detail::arm_barrier();
- default:;
- }
-}
-
-#define BOOST_ATOMIC_SIGNAL_FENCE 2
-static inline void
-atomic_signal_fence(memory_order)
-{
- __asm__ __volatile__ ("" ::: "memory");
-}
-
-class atomic_flag {
-private:
- atomic_flag(const atomic_flag &) /* = delete */ ;
- atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
- uint32_t v_;
-public:
- atomic_flag(void) : v_(false) {}
-
- void
- clear(memory_order order = memory_order_seq_cst) volatile
- {
- atomics::detail::platform_fence_before_store(order);
- const_cast<volatile uint32_t &>(v_) = 0;
- atomics::detail::platform_fence_after_store(order);
- }
-
- bool
- test_and_set(memory_order order = memory_order_seq_cst) volatile
- {