Update of /cvsroot/boost/boost/boost/interprocess/containers
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30311/containers
Modified Files:
slist.hpp string.hpp vector.hpp
Log Message:
no message
Index: slist.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/containers/slist.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- slist.hpp 12 Jun 2007 17:07:08 -0000 1.6
+++ slist.hpp 23 Jun 2007 12:53:54 -0000 1.7
@@ -51,9 +51,6 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/iterator/reverse_iterator.hpp>
-#include <boost/iterator.hpp>
-#include <boost/type_traits/is_integral.hpp>
#include <boost/interprocess/detail/move.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/mpl.hpp>
@@ -83,6 +80,9 @@
, boost::intrusive::safe_link
, VoidPointer> IslistData;
+ slist_node()
+ : m_data()
+ {}
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template<class Convertible>
slist_node(const Convertible &value)
@@ -159,6 +159,9 @@
{ new(detail::get_pointer(ptr)) Node(forward<Convertible>(value)); }
#endif
+ static void construct(const NodePtr &ptr)
+ { new(detail::get_pointer(ptr)) Node(); }
+
static void destroy(const NodePtr &ptr)
{ detail::get_pointer(ptr)->~Node(); }
@@ -184,6 +187,15 @@
}
#endif
+ NodePtr create_node()
+ {
+ NodePtr p = NodeAlloc::allocate(1);
+ Deallocator node_deallocator(p, *this);
+ self_t::construct(p);
+ node_deallocator.release();
+ return (p);
+ }
+
void destroy_node(NodePtr node)
{
self_t::destroy(node);
@@ -321,7 +333,7 @@
public:
//! Const iterator used to iterate through a list.
class const_iterator
- : public boost::iterator<std::forward_iterator_tag,
+ : public std::iterator<std::forward_iterator_tag,
value_type, list_difference_type,
list_const_pointer, list_const_reference>
{
@@ -545,8 +557,8 @@
template <class InpIt>
void assign(InpIt first, InpIt last)
{
- const bool aux_boolean = boost::is_integral<InpIt>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InpIt,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->assign_dispatch(first, last, Result());
}
@@ -687,7 +699,7 @@
//!
//! <b>Complexity</b>: Amortized constant time.
void pop_front()
- { this->m_islist.pop_front_and_destroy(Destroyer(*this)); }
+ { this->m_islist.pop_front_and_dispose(Destroyer(*this)); }
//! <b>Returns</b>: The iterator to the element before i in the sequence.
//! Returns the end-iterator, if either i is the begin-iterator or the
@@ -836,7 +848,7 @@
//! <b>Note</b>: Does not invalidate iterators or references to non erased
elements.
iterator erase_after(iterator prev_pos)
{
- return iterator(this->m_islist.erase_after_and_destroy(prev_pos.get(),
Destroyer(*this)));
+ return iterator(this->m_islist.erase_after_and_dispose(prev_pos.get(),
Destroyer(*this)));
}
//! <b>Effects</b>: Erases the range (before_first, last) from
@@ -852,7 +864,7 @@
//! <b>Note</b>: Does not invalidate iterators or references to non erased
elements.
iterator erase_after(iterator before_first, iterator last)
{
- return
iterator(this->m_islist.erase_after_and_destroy(before_first.get(), last.get(),
Destroyer(*this)));
+ return
iterator(this->m_islist.erase_after_and_dispose(before_first.get(), last.get(),
Destroyer(*this)));
}
//! <b>Requires</b>: p must be a valid iterator of *this.
@@ -916,14 +928,8 @@
}
else{
size_type n = newsize - len;
- iterator c(cur);
- while(n--){
- T default_constructed;
- if(boost::is_scalar<T>::value){
- //Value initialization hack. Fix me!
- new(&default_constructed)T();
- }
- c = this->insert_after(c, move(default_constructed));
+ for (size_type i = 0; i < n; ++i){
+ cur = this->m_islist.insert_after(cur, *this->create_node());
}
}
}
@@ -934,11 +940,7 @@
//!
//! <b>Complexity</b>: Linear to the number of elements in the list.
void clear()
- { this->m_islist.clear_and_destroy(Destroyer(*this)); }
-
- // Removes all of the elements from the slist x to *this, inserting
- // them immediately after p. x must not be *this. Complexity:
- // linear in x.size().
+ { this->m_islist.clear_and_dispose(Destroyer(*this)); }
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this
@@ -1155,7 +1157,7 @@
void remove_if(Pred pred)
{
typedef ValueCompareToNodeCompare<Pred> Predicate;
- this->m_islist.remove_and_destroy_if(Predicate(pred), Destroyer(*this));
+ this->m_islist.remove_and_dispose_if(Predicate(pred), Destroyer(*this));
}
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
@@ -1183,7 +1185,7 @@
void unique(Pred pred)
{
typedef ValueCompareToNodeCompare<Pred> Predicate;
- this->m_islist.unique_and_destroy(Predicate(pred), Destroyer(*this));
+ this->m_islist.unique_and_dispose(Predicate(pred), Destroyer(*this));
}
//! <b>Requires</b>: The lists x and *this must be distinct.
@@ -1282,12 +1284,12 @@
}
template <class Int>
- void assign_dispatch(Int n, Int val, true_)
+ void assign_dispatch(Int n, Int val, detail::true_)
{ this->fill_assign((size_type) n, (T)val); }
template <class InpIt>
void assign_dispatch(InpIt first, InpIt last,
- false_)
+ detail::false_)
{
iterator end_n(end());
iterator prev(before_begin());
@@ -1316,17 +1318,17 @@
template <class InIter>
void insert_after_range(iterator prev_pos, InIter first, InIter last)
{
- const bool aux_boolean = boost::is_integral<InIter>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InIter,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->insert_after_range(prev_pos, first, last, Result());
}
template <class Int>
- void insert_after_range(iterator prev_pos, Int n, Int x, true_)
+ void insert_after_range(iterator prev_pos, Int n, Int x, detail::true_)
{ this->priv_insert_after_fill(prev_pos, n, x); }
template <class InIter>
- void insert_after_range(iterator prev_pos, InIter first, InIter last,
false_)
+ void insert_after_range(iterator prev_pos, InIter first, InIter last,
detail::false_)
{
typename Islist::iterator intrusive_it(prev_pos.get());
while (first != last){
Index: string.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/containers/string.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- string.hpp 12 Jun 2007 17:07:08 -0000 1.6
+++ string.hpp 23 Jun 2007 12:53:54 -0000 1.7
@@ -40,7 +40,6 @@
#include <boost/interprocess/allocators/allocation_type.hpp>
#include <boost/interprocess/detail/mpl.hpp>
#include <boost/interprocess/detail/move.hpp>
-#include <boost/type_traits/is_integral.hpp>
#include <functional>
#include <string>
@@ -54,8 +53,7 @@
#include <locale>
#include <cstddef>
#include <climits>
-#include <boost/type_traits/type_with_alignment.hpp>
-#include <boost/type_traits/alignment_of.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
@@ -154,8 +152,9 @@
};
//This basic type should have the same alignment as long_t
- typedef typename
type_with_alignment<boost::alignment_of<long_t>::value>::type
- long_alignment_type;
+// typedef typename
type_with_alignment<detail::alignment_of<long_t>::value>::type
+// long_alignment_type;
+ typedef void *long_alignment_type;
//This type is the first part of the structure controlling a short string
//The "data" member stores
@@ -234,9 +233,9 @@
protected:
- typedef boost::integral_constant<unsigned, 1> allocator_v1;
- typedef boost::integral_constant<unsigned, 2> allocator_v2;
- typedef boost::integral_constant<unsigned,
+ typedef detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef detail::integral_constant<unsigned,
boost::interprocess::detail::version<A>::value> alloc_version;
std::pair<pointer, bool>
@@ -495,9 +494,9 @@
//! Const iterator used to iterate through a string. It's a Random Access
Iterator
typedef const_pointer const_iterator;
//! Iterator used to iterate backwards through a string
- typedef boost::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
//! Const iterator used to iterate backwards through a string
- typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
//! The largest possible value of type size_type. That is, size_type(-1).
static const size_type npos;
@@ -591,8 +590,8 @@
: base_t(a)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<InputIterator>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InputIterator,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->priv_initialize_dispatch(f, l, Result());
}
@@ -983,8 +982,8 @@
basic_string& assign(InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<InputIter>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InputIter,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
return this->priv_assign_dispatch(first, last, Result());
}
@@ -1084,8 +1083,8 @@
void insert(iterator p, InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<InputIter>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InputIter,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(p, first, last, Result());
}
@@ -1227,8 +1226,8 @@
InputIter f, InputIter l)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<iterator>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InputIter,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
return this->priv_replace_dispatch(first, last, f, l, Result());
}
@@ -1619,7 +1618,7 @@
}
template <class Integer>
- void priv_initialize_dispatch(Integer n, Integer x, true_)
+ void priv_initialize_dispatch(Integer n, Integer x, detail::true_)
{
this->allocate_initial_block(max_value<difference_type>(n+1,
InternalBufferChars));
priv_uninitialized_fill_n(this->priv_addr(), n, x);
@@ -1628,7 +1627,7 @@
}
template <class InputIter>
- void priv_initialize_dispatch(InputIter f, InputIter l, false_)
+ void priv_initialize_dispatch(InputIter f, InputIter l, detail::false_)
{ this->priv_range_initialize(f, l); }
template<class FwdIt, class Count> inline
@@ -1678,12 +1677,12 @@
}
template <class Integer>
- basic_string& priv_assign_dispatch(Integer n, Integer x, true_)
+ basic_string& priv_assign_dispatch(Integer n, Integer x, detail::true_)
{ return this->assign((size_type) n, (CharT) x); }
template <class InputIter>
basic_string& priv_assign_dispatch(InputIter f, InputIter l,
- false_)
+ detail::false_)
{
size_type cur = 0;
CharT *ptr = detail::get_pointer(this->priv_addr());
@@ -1814,12 +1813,12 @@
template <class Integer>
void priv_insert_dispatch(iterator p, Integer n, Integer x,
- true_)
+ detail::true_)
{ insert(p, (size_type) n, (CharT) x); }
template <class InputIter>
void priv_insert_dispatch(iterator p, InputIter first, InputIter last,
- false_)
+ detail::false_)
{
typedef typename std::iterator_traits<InputIter>::iterator_category
Category;
priv_insert(p, first, last, Category());
@@ -1838,13 +1837,13 @@
template <class Integer>
basic_string& priv_replace_dispatch(iterator first, iterator last,
Integer n, Integer x,
- true_)
+ detail::true_)
{ return this->replace(first, last, (size_type) n, (CharT) x); }
template <class InputIter>
basic_string& priv_replace_dispatch(iterator first, iterator last,
InputIter f, InputIter l,
- false_)
+ detail::false_)
{
typedef typename std::iterator_traits<InputIter>::iterator_category
Category;
return this->priv_replace(first, last, f, l, Category());
Index: vector.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/containers/vector.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- vector.hpp 12 Jun 2007 17:07:08 -0000 1.7
+++ vector.hpp 23 Jun 2007 12:53:54 -0000 1.8
@@ -54,11 +54,7 @@
#include <utility>
#include <boost/detail/no_exceptions_support.hpp>
-#include <boost/iterator.hpp>
-#include <boost/iterator/reverse_iterator.hpp>
-#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <boost/type_traits/integral_constant.hpp>
#include <boost/interprocess/detail/version_type.hpp>
#include <boost/interprocess/allocators/allocation_type.hpp>
@@ -114,11 +110,10 @@
~vector_alloc_holder()
{ this->prot_deallocate(); }
- typedef boost::integral_constant<unsigned, 1> allocator_v1;
- typedef boost::integral_constant<unsigned, 2> allocator_v2;
- typedef boost::integral_constant<unsigned,
+ typedef detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef detail::integral_constant<unsigned, 2> allocator_v2;
+ typedef detail::integral_constant<unsigned,
boost::interprocess::detail::version<A>::value> alloc_version;
-
std::pair<pointer, bool>
allocation_command(allocation_type command,
size_type limit_size,
@@ -236,7 +231,7 @@
//! Const iterator used to iterate through a vector.
class const_iterator
- : public boost::iterator<std::random_access_iterator_tag
+ : public std::iterator<std::random_access_iterator_tag
,value_type
,vec_diff
,vec_cptr
@@ -378,10 +373,10 @@
};
//! Iterator used to iterate backwards through a vector.
- typedef boost::reverse_iterator<iterator>
+ typedef std::reverse_iterator<iterator>
reverse_iterator;
//! Const iterator used to iterate backwards through a vector.
- typedef boost::reverse_iterator<const_iterator>
+ typedef std::reverse_iterator<const_iterator>
const_reverse_iterator;
public:
@@ -775,8 +770,8 @@
void assign(InIt first, InIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<InIt>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InIt,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->priv_assign_dispatch(first, last, Result());
}
@@ -933,8 +928,8 @@
void insert(iterator pos, InIt first, InIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = boost::is_integral<InIt>::value;
- typedef bool_<aux_boolean> Result;
+ const bool aux_boolean = detail::is_convertible<InIt,
std::size_t>::value;
+ typedef detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(pos, first, last, Result());
}
@@ -1038,13 +1033,11 @@
else{
size_type n = new_size - this->size();
this->reserve(new_size);
+ T *ptr = detail::get_pointer(this->m_start + this->m_size);
while(n--){
- T default_constructed;
- if(boost::is_scalar<T>::value){
- //Value initialization
- new(&default_constructed)T();
- }
- this->push_back(move(default_constructed));
+ //Default construct
+ new(ptr++)T();
+ ++this->m_size;
}
}
}
@@ -1195,7 +1188,7 @@
(pointer new_start, size_type new_capacity,
pointer pos, FwdIt first, FwdIt last, size_type n)
{
- typedef detail::scoped_destructor_n<pointer> ValueArrayDestructor;
+ typedef detail::scoped_destructor_n<allocator_type> ValueArrayDestructor;
typedef detail::move_iterator<pointer> move_it;
//Backup old data
pointer old_start = this->m_start;
@@ -1587,7 +1580,7 @@
//Backwards expansion
//If anything goes wrong, this object will destroy
//all old objects
- typedef detail::scoped_destructor_n<pointer> ValueArrayDestructor;
+ typedef detail::scoped_destructor_n<allocator_type>
ValueArrayDestructor;
pointer old_start = this->m_start;
size_type old_size = this->m_size;
ValueArrayDestructor old_values_destroyer(old_start, old_size);
@@ -1634,12 +1627,11 @@
}
template <class Integer>
- void priv_assign_dispatch(Integer n, Integer val, true_)
+ void priv_assign_dispatch(Integer n, Integer val, detail::true_)
{ this->assign((size_type) n, (T) val); }
template <class InIt>
- void priv_assign_dispatch(InIt first, InIt last,
- false_)
+ void priv_assign_dispatch(InIt first, InIt last, detail::false_)
{
//Dispatch depending on integer/iterator
typedef typename
@@ -1648,13 +1640,12 @@
}
template <class Integer>
- void priv_insert_dispatch( iterator pos, Integer n,
- Integer val, true_)
+ void priv_insert_dispatch( iterator pos, Integer n, Integer val,
detail::true_)
{ this->insert(pos, (size_type)n, (T)val); }
template <class InIt>
void priv_insert_dispatch(iterator pos, InIt first,
- InIt last, false_)
+ InIt last, detail::false_)
{
//Dispatch depending on integer/iterator
typedef typename
@@ -1663,7 +1654,7 @@
}
template <class Integer>
- void priv_initialize_aux(Integer n, Integer value, true_)
+ void priv_initialize_aux(Integer n, Integer value, detail::true_)
{
this->priv_range_initialize(cvalue_iterator(value, n),
cvalue_iterator(),
@@ -1672,7 +1663,7 @@
template <class InIt>
void priv_initialize_aux(InIt first, InIt last,
- false_)
+ detail::false_)
{
//Dispatch depending on integer/iterator
typedef typename
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs