Compare commits

..

4 Commits

Author SHA1 Message Date
Glen Fernandes
4ef6e8d1f6 Merge branch 'develop' 2018-02-04 23:13:19 -05:00
Glen Fernandes
5c5bef6cee Use to_address free function instead of pointer_traits member 2017-11-23 23:21:39 -05:00
Glen Fernandes
2a3e26ff63 Merge pull request #14 from rarevans/spelling
correct spelling in comments for circular_buffer example
2017-10-06 08:19:23 -04:00
Richard Evans
e655fa6c4d correct spelling in comments for circular_buffer example 2017-10-06 12:44:29 +10:00
3 changed files with 15 additions and 22 deletions

View File

@@ -20,7 +20,7 @@
// Create a circular buffer with a capacity for 3 integers.
boost::circular_buffer<int> cb(3);
// Insert threee elements into the buffer.
// Insert three elements into the buffer.
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);

View File

@@ -666,7 +666,7 @@ public:
break;
}
if (is_uninitialized(dest)) {
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(dest), boost::move_if_noexcept(*src));
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(dest), boost::move_if_noexcept(*src));
++constructed;
} else {
value_type tmp = boost::move_if_noexcept(*src);
@@ -1422,7 +1422,7 @@ private:
increment(m_last);
m_first = m_last;
} else {
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_last), static_cast<ValT>(item));
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(m_last), static_cast<ValT>(item));
increment(m_last);
++m_size;
}
@@ -1439,7 +1439,7 @@ private:
m_last = m_first;
} else {
decrement(m_first);
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_first), static_cast<ValT>(item));
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(m_first), static_cast<ValT>(item));
++m_size;
}
} BOOST_CATCH(...) {
@@ -2414,7 +2414,7 @@ private:
*/
void construct_or_replace(bool construct, pointer pos, param_value_type item) {
if (construct)
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(pos), item);
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(pos), item);
else
replace(pos, item);
}
@@ -2426,14 +2426,14 @@ private:
*/
void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
if (construct)
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(pos), boost::move(item));
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(pos), boost::move(item));
else
replace(pos, boost::move(item));
}
//! Destroy an item.
void destroy_item(pointer p) {
boost::container::allocator_traits<Alloc>::destroy(m_alloc, cb_details::to_address(p));
boost::container::allocator_traits<Alloc>::destroy(m_alloc, boost::to_address(p));
#if BOOST_CB_ENABLE_DEBUG
invalidate_iterators(iterator(this, p));
cb_details::do_fill_uninitialized_memory(p, sizeof(value_type));
@@ -2566,7 +2566,7 @@ private:
if (buffer_capacity == 0)
return;
while (first != last && !full()) {
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_last), *first++);
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(m_last), *first++);
increment(m_last);
++m_size;
}
@@ -2831,7 +2831,7 @@ private:
pointer p = m_last;
BOOST_TRY {
for (; ii < construct; ++ii, increment(p))
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(p), *wrapper());
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(p), *wrapper());
for (;ii < n; ++ii, increment(p))
replace(p, *wrapper());
} BOOST_CATCH(...) {
@@ -2925,7 +2925,7 @@ private:
for (;ii > construct; --ii, increment(p))
replace(p, *wrapper());
for (; ii > 0; --ii, increment(p))
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(p), *wrapper());
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::to_address(p), *wrapper());
} BOOST_CATCH(...) {
size_type constructed = ii < construct ? construct - ii : 0;
m_last = add(m_last, constructed);

View File

@@ -35,13 +35,6 @@ namespace boost {
namespace cb_details {
template<class Pointer>
inline typename boost::pointer_traits<Pointer>::element_type*
to_address(Pointer p) BOOST_NOEXCEPT
{
return boost::pointer_traits<Pointer>::to_address(p);
}
template <class Traits> struct nonconst_traits;
template<class ForwardIterator, class Diff, class T, class Alloc>
@@ -443,10 +436,10 @@ inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator las
ForwardIterator next = dest;
BOOST_TRY {
for (; first != last; ++first, ++dest)
boost::container::allocator_traits<Alloc>::construct(a, cb_details::to_address(dest), *first);
boost::container::allocator_traits<Alloc>::construct(a, boost::to_address(dest), *first);
} BOOST_CATCH(...) {
for (; next != dest; ++next)
boost::container::allocator_traits<Alloc>::destroy(a, cb_details::to_address(next));
boost::container::allocator_traits<Alloc>::destroy(a, boost::to_address(next));
BOOST_RETHROW
}
BOOST_CATCH_END
@@ -457,7 +450,7 @@ template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
true_type) {
for (; first != last; ++first, ++dest)
boost::container::allocator_traits<Alloc>::construct(a, cb_details::to_address(dest), boost::move(*first));
boost::container::allocator_traits<Alloc>::construct(a, boost::to_address(dest), boost::move(*first));
return dest;
}
@@ -486,10 +479,10 @@ inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const
ForwardIterator next = first;
BOOST_TRY {
for (; n > 0; ++first, --n)
boost::container::allocator_traits<Alloc>::construct(alloc, cb_details::to_address(first), item);
boost::container::allocator_traits<Alloc>::construct(alloc, boost::to_address(first), item);
} BOOST_CATCH(...) {
for (; next != first; ++next)
boost::container::allocator_traits<Alloc>::destroy(alloc, cb_details::to_address(next));
boost::container::allocator_traits<Alloc>::destroy(alloc, boost::to_address(next));
BOOST_RETHROW
}
BOOST_CATCH_END