|
Boost-Commit : |
From: igaztanaga_at_[hidden]
Date: 2008-06-21 05:05:15
Author: igaztanaga
Date: 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
New Revision: 46572
URL: http://svn.boost.org/trac/boost/changeset/46572
Log:
gcc 4.3 fixes for normal and -std=c++0x modes
Added:
trunk/boost/interprocess/sync/math_functions.hpp (contents, props changed)
Text files modified:
trunk/boost/interprocess/allocators/adaptive_pool.hpp | 2
trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp | 9 +-
trunk/boost/interprocess/allocators/cached_node_allocator.hpp | 9 +-
trunk/boost/interprocess/allocators/node_allocator.hpp | 2
trunk/boost/interprocess/allocators/private_adaptive_pool.hpp | 4
trunk/boost/interprocess/allocators/private_node_allocator.hpp | 4
trunk/boost/interprocess/anonymous_shared_memory.hpp | 18 +++++-
trunk/boost/interprocess/containers/deque.hpp | 24 ++++----
trunk/boost/interprocess/containers/detail/flat_tree.hpp | 18 +++---
trunk/boost/interprocess/containers/detail/node_alloc_holder.hpp | 16 +++---
trunk/boost/interprocess/containers/detail/tree.hpp | 14 ++--
trunk/boost/interprocess/containers/flat_map.hpp | 103 ++++++++++++++++++++++-----------------
trunk/boost/interprocess/containers/flat_set.hpp | 24 ++++----
trunk/boost/interprocess/containers/list.hpp | 35 ++++++++----
trunk/boost/interprocess/containers/map.hpp | 50 +++++++++---------
trunk/boost/interprocess/containers/set.hpp | 24 ++++----
trunk/boost/interprocess/containers/slist.hpp | 14 ++--
trunk/boost/interprocess/containers/string.hpp | 14 ++--
trunk/boost/interprocess/containers/vector.hpp | 16 +++--
trunk/boost/interprocess/detail/algorithms.hpp | 84 ++++++++++++++++++++++++++++++--
trunk/boost/interprocess/detail/file_wrapper.hpp | 2
trunk/boost/interprocess/detail/managed_memory_impl.hpp | 14 ++++-
trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp | 14 ++--
trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp | 6 +
trunk/boost/interprocess/detail/math_functions.hpp | 1
trunk/boost/interprocess/detail/move.hpp | 30 ++++++++--
trunk/boost/interprocess/detail/move_iterator.hpp | 4
trunk/boost/interprocess/detail/mpl.hpp | 1
trunk/boost/interprocess/detail/utilities.hpp | 62 +++++++++++++++++------
trunk/boost/interprocess/detail/win32_api.hpp | 2
trunk/boost/interprocess/detail/workaround.hpp | 2
trunk/boost/interprocess/file_mapping.hpp | 18 ++++++
trunk/boost/interprocess/managed_mapped_file.hpp | 29 +++++++++++
trunk/boost/interprocess/managed_shared_memory.hpp | 32 ++++++++++++
trunk/boost/interprocess/managed_windows_shared_memory.hpp | 39 ++++++++++++--
trunk/boost/interprocess/mapped_region.hpp | 25 ++++++--
trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 14 ++--
trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 6 +-
trunk/boost/interprocess/segment_manager.hpp | 87 ++++++++++++++++++++++++++------
trunk/boost/interprocess/shared_memory_object.hpp | 18 ++++++
trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp | 5 +
trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp | 1
trunk/boost/interprocess/smart_ptr/shared_ptr.hpp | 74 +++++++++++++++++++++++++---
trunk/boost/interprocess/smart_ptr/unique_ptr.hpp | 28 ++++++----
trunk/boost/interprocess/smart_ptr/weak_ptr.hpp | 5 +
trunk/boost/interprocess/sync/emulation/interprocess_condition.hpp | 10 +-
trunk/boost/interprocess/sync/scoped_lock.hpp | 17 +++---
trunk/boost/interprocess/sync/sharable_lock.hpp | 18 +++---
trunk/boost/interprocess/sync/upgradable_lock.hpp | 12 ++--
trunk/boost/interprocess/windows_shared_memory.hpp | 2
50 files changed, 742 insertions(+), 320 deletions(-)
Modified: trunk/boost/interprocess/allocators/adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/adaptive_pool.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -69,7 +69,7 @@
struct node_pool
{
typedef detail::shared_adaptive_node_pool
- < SegmentManager, sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> type;
+ < SegmentManager, sizeof_value<T>::value, NodesPerBlock, MaxFreeBlocks, OverheadPercent> type;
static type *get(void *p)
{ return static_cast<type*>(p); }
Modified: trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -21,6 +21,7 @@
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp>
#include <boost/interprocess/allocators/detail/allocator_common.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/version_type.hpp>
#include <boost/interprocess/allocators/detail/node_tools.hpp>
@@ -47,7 +48,7 @@
< T
, detail::shared_adaptive_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
@@ -59,7 +60,7 @@
< T
, detail::shared_adaptive_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
@@ -119,7 +120,7 @@
< T
, detail::shared_adaptive_node_pool
< SegmentManager
- , sizeof(typename detail::if_c<detail::is_same<T, void>::value, int, T>::type)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
@@ -134,7 +135,7 @@
< T
, detail::shared_adaptive_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
Modified: trunk/boost/interprocess/allocators/cached_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_node_allocator.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -22,6 +22,7 @@
#include <boost/interprocess/allocators/detail/node_pool.hpp>
#include <boost/interprocess/allocators/detail/allocator_common.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/version_type.hpp>
#include <boost/interprocess/allocators/detail/node_tools.hpp>
#include <cstddef>
@@ -46,7 +47,7 @@
< T
, detail::shared_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
>
, 1>
@@ -56,7 +57,7 @@
< T
, detail::shared_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
>
, 1> base_t;
@@ -95,7 +96,7 @@
< T
, detail::shared_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
>
, 2>
@@ -108,7 +109,7 @@
< T
, detail::shared_node_pool
< SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
>
, 2> base_t;
Modified: trunk/boost/interprocess/allocators/node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/node_allocator.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -66,7 +66,7 @@
struct node_pool
{
typedef detail::shared_node_pool
- < SegmentManager, sizeof(T), NodesPerBlock> type;
+ < SegmentManager, sizeof_value<T>::value, NodesPerBlock> type;
static type *get(void *p)
{ return static_cast<type*>(p); }
Modified: trunk/boost/interprocess/allocators/private_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/private_adaptive_pool.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -67,7 +67,7 @@
, MaxFreeBlocks, OverheadPercent> self_t;
typedef detail::private_adaptive_node_pool
<SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
@@ -113,7 +113,7 @@
{
typedef detail::private_adaptive_node_pool
<SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
, MaxFreeBlocks
, OverheadPercent
Modified: trunk/boost/interprocess/allocators/private_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/private_node_allocator.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -63,7 +63,7 @@
< Version, T, SegmentManager, NodesPerBlock> self_t;
typedef detail::private_node_pool
<SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
> node_pool_t;
@@ -106,7 +106,7 @@
{
typedef detail::private_node_pool
<SegmentManager
- , sizeof(T)
+ , sizeof_value<T>::value
, NodesPerBlock
> type;
Modified: trunk/boost/interprocess/anonymous_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/anonymous_shared_memory.hpp (original)
+++ trunk/boost/interprocess/anonymous_shared_memory.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -42,7 +42,13 @@
class raw_mapped_region_creator
{
public:
- static move_return<mapped_region> create_posix_mapped_region(void *address, offset_t offset, std::size_t size)
+ static
+ #ifdef BOOST_INTERPROCESS_RVALUE_REFERENCE
+ mapped_region
+ #else
+ move_return<mapped_region>
+ #endif
+ create_posix_mapped_region(void *address, offset_t offset, std::size_t size)
{
mapped_region region;
region.m_base = address;
@@ -61,7 +67,13 @@
//!Otherwise the operating system will choose the mapping address.
//!The function returns a mapped_region holding that segment or throws
//!interprocess_exception if the function fails.
-static detail::move_return<mapped_region> anonymous_shared_memory(std::size_t size, void *address = 0)
+static
+#ifdef BOOST_INTERPROCESS_RVALUE_REFERENCE
+mapped_region
+#else
+detail::move_return<mapped_region>
+#endif
+anonymous_shared_memory(std::size_t size, void *address = 0)
#if (!defined(BOOST_WINDOWS)) || defined(BOOST_DISABLE_WIN32)
{
int flags;
@@ -104,7 +116,7 @@
{
windows_shared_memory anonymous_mapping(create_only, 0, read_write, size);
mapped_region region(anonymous_mapping, read_write, 0, size, address);
- return detail::move_return<mapped_region>(region);
+ return region;
}
#endif
Modified: trunk/boost/interprocess/containers/deque.hpp
==============================================================================
--- trunk/boost/interprocess/containers/deque.hpp (original)
+++ trunk/boost/interprocess/containers/deque.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -580,7 +580,7 @@
{ this->swap(mx.get()); }
#else
deque(deque &&x)
- : Base(x))
+ : Base(detail::move_impl(x))
{ this->swap(x); }
#endif
@@ -679,11 +679,11 @@
void push_back(value_type &&mt)
{
if (this->members_.m_finish.m_cur != this->members_.m_finish.m_last - 1) {
- new((void*)detail::get_pointer(this->members_.m_finish.m_cur))value_type(move(mt));
+ new((void*)detail::get_pointer(this->members_.m_finish.m_cur))value_type(detail::move_impl(mt));
++this->members_.m_finish.m_cur;
}
else
- this->priv_push_back_aux(move(mt));
+ this->priv_push_back_aux(detail::move_impl(mt));
}
#endif
@@ -711,11 +711,11 @@
void push_front(value_type &&mt)
{
if (this->members_.m_start.m_cur != this->members_.m_start.m_first) {
- new((void*)(detail::get_pointer(this->members_.m_start.m_cur)- 1))value_type(move(mt));
+ new((void*)(detail::get_pointer(this->members_.m_start.m_cur)- 1))value_type(detail::move_impl(mt));
--this->members_.m_start.m_cur;
}
else
- this->priv_push_front_aux(move(mt));
+ this->priv_push_front_aux(detail::move_impl(mt));
}
#endif
@@ -777,17 +777,17 @@
iterator insert(iterator position, value_type &&mx)
{
if (position.m_cur == this->members_.m_start.m_cur) {
- this->push_front(move(mx));
+ this->push_front(detail::move_impl(mx));
return this->members_.m_start;
}
else if (position.m_cur == this->members_.m_finish.m_cur) {
- this->push_back(move(mx));
+ this->push_back(detail::move_impl(mx));
iterator tmp = this->members_.m_finish;
--tmp;
return tmp;
}
else {
- return this->priv_insert_aux(position, move(mx));
+ return this->priv_insert_aux(position, detail::move_impl(mx));
}
}
#endif
@@ -824,13 +824,13 @@
this->priv_reserve_elements_at_back(new_size);
while(n--){
- //T default_constructed = move(T());
+ //T default_constructed = detail::move_impl(T());
T default_constructed;
/* if(boost::is_scalar<T>::value){
//Value initialization
new(&default_constructed)T();
}*/
- this->push_back(move(default_constructed));
+ this->push_back(detail::move_impl(default_constructed));
}
}
}
@@ -1251,7 +1251,7 @@
this->priv_reserve_map_at_back();
*(this->members_.m_finish.m_node + 1) = this->priv_allocate_node();
BOOST_TRY {
- new((void*)detail::get_pointer(this->members_.m_finish.m_cur))value_type(move(mt));
+ new((void*)detail::get_pointer(this->members_.m_finish.m_cur))value_type(detail::move_impl(mt));
this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node + 1);
this->members_.m_finish.m_cur = this->members_.m_finish.m_first;
}
@@ -1306,7 +1306,7 @@
BOOST_TRY {
this->members_.m_start.priv_set_node(this->members_.m_start.m_node - 1);
this->members_.m_start.m_cur = this->members_.m_start.m_last - 1;
- new((void*)detail::get_pointer(this->members_.m_start.m_cur))value_type(move(mt));
+ new((void*)detail::get_pointer(this->members_.m_start.m_cur))value_type(detail::move_impl(mt));
}
BOOST_CATCH(...){
++this->members_.m_start;
Modified: trunk/boost/interprocess/containers/detail/flat_tree.hpp
==============================================================================
--- trunk/boost/interprocess/containers/detail/flat_tree.hpp (original)
+++ trunk/boost/interprocess/containers/detail/flat_tree.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -135,11 +135,11 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_tree(const detail::moved_object<flat_tree> &x)
- : m_data(move(x.get().m_data))
+ : m_data(detail::move_impl(x.get().m_data))
{ }
#else
flat_tree(flat_tree &&x)
- : m_data(move(x.m_data))
+ : m_data(detail::move_impl(x.m_data))
{ }
#endif
@@ -151,10 +151,10 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_tree& operator=(const detail::moved_object<flat_tree>& mx)
- { m_data = move(mx.get().m_data); return *this; }
+ { m_data = detail::move_impl(mx.get().m_data); return *this; }
#else
flat_tree& operator=(flat_tree &&mx)
- { m_data = move(mx.m_data); return *this; }
+ { m_data = detail::move_impl(mx.m_data); return *this; }
#endif
public:
@@ -250,7 +250,7 @@
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(mval, data);
if(ret.second){
- ret.first = priv_insert_commit(data, move(mval));
+ ret.first = priv_insert_commit(data, detail::move_impl(mval));
}
return ret;
}
@@ -275,7 +275,7 @@
iterator insert_equal(value_type && mval)
{
iterator i = this->upper_bound(KeyOfValue()(mval));
- i = this->m_data.m_vect.insert(i, move(mval));
+ i = this->m_data.m_vect.insert(i, detail::move_impl(mval));
return i;
}
#endif
@@ -306,7 +306,7 @@
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(pos, mval, data);
if(ret.second){
- ret.first = priv_insert_commit(data, move(mval));
+ ret.first = priv_insert_commit(data, detail::move_impl(mval));
}
return ret.first;
}
@@ -331,7 +331,7 @@
{
insert_commit_data data;
priv_insert_equal_prepare(pos, mval, data);
- return priv_insert_commit(data, move(mval));
+ return priv_insert_commit(data, detail::move_impl(mval));
}
#endif
@@ -547,7 +547,7 @@
template<class Convertible>
iterator priv_insert_commit
(insert_commit_data &commit_data, Convertible &&convertible)
- { return this->m_data.m_vect.insert(commit_data.position, forward<Convertible>(convertible)); }
+ { return this->m_data.m_vect.insert(commit_data.position, detail::forward_impl<Convertible>(convertible)); }
#endif
template <class RanIt>
Modified: trunk/boost/interprocess/containers/detail/node_alloc_holder.hpp
==============================================================================
--- trunk/boost/interprocess/containers/detail/node_alloc_holder.hpp (original)
+++ trunk/boost/interprocess/containers/detail/node_alloc_holder.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -88,11 +88,11 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
node_alloc_holder(const detail::moved_object<node_alloc_holder> &other)
- : members_(move(other.get().node_alloc()))
+ : members_(detail::move_impl(other.get().node_alloc()))
{ this->swap(other.get()); }
#else
node_alloc_holder(node_alloc_holder &&other)
- : members_(move(other.node_alloc()))
+ : members_(detail::move_impl(other.node_alloc()))
{ this->swap(other); }
#endif
@@ -149,7 +149,7 @@
#else
template<class Convertible>
static void construct(const NodePtr &ptr, Convertible &&value)
- { new((void*)detail::get_pointer(ptr)) Node(forward<Convertible>(value)); }
+ { new((void*)detail::get_pointer(ptr)) Node(detail::forward_impl<Convertible>(value)); }
#endif
static void construct(const NodePtr &ptr)
@@ -169,9 +169,9 @@
new(static_cast<hook_type*>(nodeptr))hook_type();
//Now construct pair members_holder
value_type *valueptr = &nodeptr->m_data;
- new((void*)&valueptr->first) first_type(move(value.get().first));
+ new((void*)&valueptr->first) first_type(detail::move_impl(value.get().first));
BOOST_TRY{
- new((void*)&valueptr->second) second_type(move(value.get().second));
+ new((void*)&valueptr->second) second_type(detail::move_impl(value.get().second));
}
BOOST_CATCH(...){
valueptr->first.~first_type();
@@ -194,9 +194,9 @@
new(static_cast<hook_type*>(nodeptr))hook_type();
//Now construct pair members_holder
value_type *valueptr = &nodeptr->m_data;
- new((void*)&valueptr->first) first_type(move(value.first));
+ new((void*)&valueptr->first) first_type(detail::move_impl(value.first));
BOOST_TRY{
- new((void*)&valueptr->second) second_type(move(value.second));
+ new((void*)&valueptr->second) second_type(detail::move_impl(value.second));
}
BOOST_CATCH(...){
valueptr->first.~first_type();
@@ -226,7 +226,7 @@
{
NodePtr p = this->allocate_one();
Deallocator node_deallocator(p, this->node_alloc());
- self_t::construct(p, forward<Convertible>(x));
+ self_t::construct(p, detail::forward_impl<Convertible>(x));
node_deallocator.release();
return (p);
}
Modified: trunk/boost/interprocess/containers/detail/tree.hpp
==============================================================================
--- trunk/boost/interprocess/containers/detail/tree.hpp (original)
+++ trunk/boost/interprocess/containers/detail/tree.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -109,7 +109,7 @@
#else
template<class Convertible>
rbtree_node(Convertible &&conv)
- : m_data(forward<Convertible>(conv)){}
+ : m_data(detail::forward_impl<Convertible>(conv)){}
#endif
rbtree_node &operator=(const rbtree_node &other)
@@ -153,7 +153,7 @@
template<class Convertible>
static void construct(node_type *ptr, Convertible &&value)
- { new(ptr) node_type(forward<Convertible>(value)); }
+ { new(ptr) node_type(detail::forward_impl<Convertible>(value)); }
template<class Convertible1, class Convertible2>
static void construct(node_type *ptr,
@@ -578,7 +578,7 @@
iterator insert_unique_commit
(MovableConvertible && mv, insert_commit_data &data)
{
- NodePtr tmp = AllocHolder::create_node(forward<MovableConvertible>(mv));
+ NodePtr tmp = AllocHolder::create_node(detail::forward_impl<MovableConvertible>(mv));
iiterator it(this->icont().insert_unique_commit(*tmp, data));
return iterator(it);
}
@@ -618,7 +618,7 @@
if(!ret.second)
return ret;
return std::pair<iterator,bool>
- (this->insert_unique_commit(forward<MovableConvertible>(mv), data), true);
+ (this->insert_unique_commit(detail::forward_impl<MovableConvertible>(mv), data), true);
}
#endif
@@ -654,7 +654,7 @@
this->insert_unique_check(hint, KeyOfValue()(mv), data);
if(!ret.second)
return ret.first;
- return this->insert_unique_commit(forward<MovableConvertible>(mv), data);
+ return this->insert_unique_commit(detail::forward_impl<MovableConvertible>(mv), data);
}
#endif
@@ -691,7 +691,7 @@
template<class MovableConvertible>
iterator insert_equal(MovableConvertible &&mv)
{
- NodePtr p(AllocHolder::create_node(forward<MovableConvertible>(mv)));
+ NodePtr p(AllocHolder::create_node(detail::forward_impl<MovableConvertible>(mv)));
return iterator(this->icont().insert_equal(this->icont().end(), *p));
}
#endif
@@ -713,7 +713,7 @@
template<class MovableConvertible>
iterator insert_equal(const_iterator hint, MovableConvertible &&mv)
{
- NodePtr p(AllocHolder::create_node(move(mv)));
+ NodePtr p(AllocHolder::create_node(detail::move_impl(mv)));
return iterator(this->icont().insert_equal(hint.get(), *p));
}
#endif
Modified: trunk/boost/interprocess/containers/flat_map.hpp
==============================================================================
--- trunk/boost/interprocess/containers/flat_map.hpp (original)
+++ trunk/boost/interprocess/containers/flat_map.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -70,6 +70,14 @@
{
/// @cond
private:
+ //This is the tree that we should store if pair was movable
+ typedef detail::flat_tree<Key,
+ std::pair<Key, T>,
+ detail::select1st< std::pair<Key, T> >,
+ Pred,
+ Alloc> tree_t;
+
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
//This is the real tree stored here. It's based on a movable pair
typedef detail::flat_tree<Key,
detail::pair<Key, T>,
@@ -77,15 +85,10 @@
Pred,
typename Alloc::template
rebind<detail::pair<Key, T> >::other> impl_tree_t;
+ #else
+ typedef tree_t impl_tree_t;
+ #endif
- //This is the tree that we should store if pair was movable
- typedef detail::flat_tree<Key,
- std::pair<Key, T>,
- detail::select1st< std::pair<Key, T> >,
- Pred,
- Alloc> tree_t;
-
-// tree_t m_flat_tree; // flat tree representing flat_map
impl_tree_t m_flat_tree; // flat tree representing flat_map
typedef typename impl_tree_t::value_type impl_value_type;
@@ -101,19 +104,23 @@
typedef typename impl_tree_t::allocator_type impl_allocator_type;
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
typedef detail::moved_object<impl_value_type> impl_moved_value_type;
- #else
- typedef impl_value_type&& impl_moved_value_type;
#endif
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template<class D, class S>
static D &force(const S &s)
- { return *const_cast<D*>((reinterpret_cast<const D*>(&s))); }
-
- #ifdef BOOST_INTERPROCESS_RVALUE_REFERENCE
- template<class D, class S>
- static D &&force(S &&s)
- { return reinterpret_cast<D&&>(s); }
+ { return *((D*)(void*)(const void*)(&s)); }
+ #else
+ //For rvalue-aware compilers, just forward
+ template<class Type>
+ static const Type &force(const Type &t)
+ { return t; }
+
+ template<class Type>
+ static Type &force(Type &t)
+ { return t; }
#endif
+
/// @endcond
public:
@@ -168,11 +175,11 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_map(const detail::moved_object<flat_map<Key,T,Pred,Alloc> >& x)
- : m_flat_tree(move(x.get().m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(x.get().m_flat_tree)) {}
#else
flat_map(flat_map<Key,T,Pred,Alloc> && x)
- : m_flat_tree(move(x.m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(x.m_flat_tree)) {}
#endif
//! <b>Effects</b>: Makes *this a copy of x.
@@ -189,10 +196,10 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_map<Key,T,Pred,Alloc>& operator=(const detail::moved_object<flat_map<Key, T, Pred, Alloc> >& mx)
- { m_flat_tree = move(mx.get().m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.get().m_flat_tree); return *this; }
#else
flat_map<Key,T,Pred,Alloc>& operator=(flat_map<Key, T, Pred, Alloc> && mx)
- { m_flat_tree = move(mx.m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.m_flat_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -315,7 +322,7 @@
{ return m_flat_tree.max_size(); }
//! Effects: If there is no key equivalent to x in the flat_map, inserts
- //! value_type(move(x), T()) into the flat_map (the key is move-constructed)
+ //! value_type(detail::move_impl(x), T()) into the flat_map (the key is move-constructed)
//!
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
@@ -342,7 +349,7 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first))
- i = insert(i, value_type(k, move(T())));
+ i = insert(i, value_type(k, detail::move_impl(T())));
return (*i).second;
}
#else
@@ -358,7 +365,7 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first))
- i = insert(i, value_type(forward<key_type>(k), move(T())));
+ i = insert(i, value_type(detail::forward_impl<key_type>(k), detail::move_impl(T())));
return (*i).second;
}
#endif
@@ -418,8 +425,7 @@
m_flat_tree.insert_unique(force<impl_moved_value_type>(x))); }
#else
std::pair<iterator,bool> insert(value_type &&x)
- { return force<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(force<impl_moved_value_type>(move(x)))); }
+ { return m_flat_tree.insert_unique(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -452,8 +458,7 @@
m_flat_tree.insert_unique(force<impl_iterator>(position), force<impl_moved_value_type>(x))); }
#else
iterator insert(iterator position, value_type &&x)
- { return force<iterator>(
- m_flat_tree.insert_unique(force<impl_iterator>(position), force<impl_moved_value_type>(move(x)))); }
+ { return m_flat_tree.insert_unique(position, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -715,6 +720,12 @@
{
/// @cond
private:
+ typedef detail::flat_tree<Key,
+ std::pair<Key, T>,
+ detail::select1st< std::pair<Key, T> >,
+ Pred,
+ Alloc> tree_t;
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
//This is the real tree stored here. It's based on a movable pair
typedef detail::flat_tree<Key,
detail::pair<Key, T>,
@@ -722,13 +733,10 @@
Pred,
typename Alloc::template
rebind<detail::pair<Key, T> >::other> impl_tree_t;
+ #else
+ typedef tree_t impl_tree_t;
+ #endif
- typedef detail::flat_tree<Key,
- std::pair<Key, T>,
- detail::select1st< std::pair<Key, T> >,
- Pred,
- Alloc> tree_t;
-// tree_t m_flat_tree; // flat tree representing flat_multimap
impl_tree_t m_flat_tree; // flat tree representing flat_map
typedef typename impl_tree_t::value_type impl_value_type;
@@ -744,18 +752,21 @@
typedef typename impl_tree_t::allocator_type impl_allocator_type;
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
typedef detail::moved_object<impl_value_type> impl_moved_value_type;
- #else
- typedef impl_value_type&& impl_moved_value_type;
#endif
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template<class D, class S>
static D &force(const S &s)
{ return *const_cast<D*>((reinterpret_cast<const D*>(&s))); }
-
- #ifdef BOOST_INTERPROCESS_RVALUE_REFERENCE
- template<class D, class S>
- static D &&force(S &&s)
- { return reinterpret_cast<D&&>(s); }
+ #else
+ //For rvalue-aware compilers, just forward
+ template<class Type>
+ static const Type &force(const Type &t)
+ { return t; }
+
+ template<class Type>
+ static Type &force(Type &t)
+ { return t; }
#endif
/// @endcond
@@ -812,10 +823,10 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_multimap(const detail::moved_object<flat_multimap<Key,T,Pred,Alloc> >& x)
- : m_flat_tree(move(x.get().m_flat_tree)) { }
+ : m_flat_tree(detail::move_impl(x.get().m_flat_tree)) { }
#else
flat_multimap(flat_multimap<Key,T,Pred,Alloc> && x)
- : m_flat_tree(move(x.m_flat_tree)) { }
+ : m_flat_tree(detail::move_impl(x.m_flat_tree)) { }
#endif
//! <b>Effects</b>: Makes *this a copy of x.
@@ -831,11 +842,11 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_multimap<Key,T,Pred,Alloc>&
operator=(const detail::moved_object<flat_multimap<Key,T,Pred,Alloc> >& mx)
- { m_flat_tree = move(mx.get().m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.get().m_flat_tree); return *this; }
#else
flat_multimap<Key,T,Pred,Alloc>&
operator=(flat_multimap<Key,T,Pred,Alloc> && mx)
- { m_flat_tree = move(mx.m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.m_flat_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -1002,7 +1013,7 @@
{ return force<iterator>(m_flat_tree.insert_equal(force<impl_moved_value_type>(x))); }
#else
iterator insert(value_type &&x)
- { return force<iterator>(m_flat_tree.insert_equal(force<impl_moved_value_type>(move(x)))); }
+ { return m_flat_tree.insert_equal(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -1035,7 +1046,7 @@
{ return force<iterator>(m_flat_tree.insert_equal(force<impl_iterator>(position), force<impl_moved_value_type>(x))); }
#else
iterator insert(iterator position, value_type &&x)
- { return force<iterator>(m_flat_tree.insert_equal(force<impl_iterator>(position), force<impl_moved_value_type>(move(x)))); }
+ { return m_flat_tree.insert_equal(force<impl_iterator>(position), detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
Modified: trunk/boost/interprocess/containers/flat_set.hpp
==============================================================================
--- trunk/boost/interprocess/containers/flat_set.hpp (original)
+++ trunk/boost/interprocess/containers/flat_set.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -117,10 +117,10 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_set(const detail::moved_object<flat_set<T,Pred,Alloc> >& mx)
- : m_flat_tree(move(mx.get().m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(mx.get().m_flat_tree)) {}
#else
flat_set(flat_set<T,Pred,Alloc> && mx)
- : m_flat_tree(move(mx.m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(mx.m_flat_tree)) {}
#endif
//! <b>Effects</b>: Makes *this a copy of x.
@@ -134,11 +134,11 @@
//! <b>Complexity</b>: Linear in x.size().
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_set<T,Pred,Alloc>& operator=(const detail::moved_object<flat_set<T, Pred, Alloc> > &mx)
- { m_flat_tree = move(mx.get().m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.get().m_flat_tree); return *this; }
#else
flat_set<T,Pred,Alloc>& operator=(flat_set<T, Pred, Alloc> &&mx)
- { m_flat_tree = move(mx.m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.m_flat_tree); return *this; }
#endif
@@ -314,7 +314,7 @@
{ return m_flat_tree.insert_unique(x); }
#else
std::pair<iterator,bool> insert(value_type && x)
- { return m_flat_tree.insert_unique(move(x)); }
+ { return m_flat_tree.insert_unique(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -345,7 +345,7 @@
{ return m_flat_tree.insert_unique(position, x); }
#else
iterator insert(iterator position, value_type && x)
- { return m_flat_tree.insert_unique(position, move(x)); }
+ { return m_flat_tree.insert_unique(position, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -633,10 +633,10 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_multiset(const detail::moved_object<flat_multiset<T,Pred,Alloc> >& x)
- : m_flat_tree(move(x.get().m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(x.get().m_flat_tree)) {}
#else
flat_multiset(flat_multiset<T,Pred,Alloc> && x)
- : m_flat_tree(move(x.m_flat_tree)) {}
+ : m_flat_tree(detail::move_impl(x.m_flat_tree)) {}
#endif
flat_multiset<T,Pred,Alloc>& operator=(const flat_multiset<T,Pred,Alloc>& x)
@@ -644,10 +644,10 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
flat_multiset<T,Pred,Alloc>& operator=(const detail::moved_object<flat_multiset<T,Pred,Alloc> >& mx)
- { m_flat_tree = move(mx.get().m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.get().m_flat_tree); return *this; }
#else
flat_multiset<T,Pred,Alloc>& operator=(flat_multiset<T,Pred,Alloc> && mx)
- { m_flat_tree = move(mx.m_flat_tree); return *this; }
+ { m_flat_tree = detail::move_impl(mx.m_flat_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -814,7 +814,7 @@
{ return m_flat_tree.insert_equal(x); }
#else
iterator insert(value_type && x)
- { return m_flat_tree.insert_equal(move(x)); }
+ { return m_flat_tree.insert_equal(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -845,7 +845,7 @@
{ return m_flat_tree.insert_equal(position, x); }
#else
iterator insert(iterator position, value_type && x)
- { return m_flat_tree.insert_equal(position, move(x)); }
+ { return m_flat_tree.insert_equal(position, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
Modified: trunk/boost/interprocess/containers/list.hpp
==============================================================================
--- trunk/boost/interprocess/containers/list.hpp (original)
+++ trunk/boost/interprocess/containers/list.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -93,7 +93,7 @@
#else
template<class Convertible>
list_node(Convertible &&conv)
- : m_data(forward<Convertible>(conv))
+ : m_data(detail::forward_impl<Convertible>(conv))
{}
#endif
@@ -323,7 +323,7 @@
{}
// list(size_type n)
-// : AllocHolder(move(allocator_type()))
+// : AllocHolder(detail::move_impl(allocator_type()))
// { this->resize(n); }
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -355,11 +355,11 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
list(const detail::moved_object<list> &x)
- : AllocHolder(move((AllocHolder&)x.get()))
+ : AllocHolder(detail::move_impl((AllocHolder&)x.get()))
{}
#else
list(list &&x)
- : AllocHolder(move((AllocHolder&)x))
+ : AllocHolder(detail::move_impl((AllocHolder&)x))
{}
#endif
@@ -518,7 +518,7 @@
{ this->insert(this->begin(), x); }
#else
void push_front(T &&x)
- { this->insert(this->begin(), move(x)); }
+ { this->insert(this->begin(), detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Removes the last element from the list.
@@ -539,7 +539,7 @@
{ this->insert(this->end(), x); }
#else
void push_back (T &&x)
- { this->insert(this->end(), move(x)); }
+ { this->insert(this->end(), detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Removes the first element from the list.
@@ -610,7 +610,7 @@
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size, const T& x)
{
- iterator i = this->begin(), iend = this->end();
+ iterator iend = this->end();
size_type len = this->size();
if(len > new_size){
@@ -633,15 +633,26 @@
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size)
{
- iterator i = this->begin(), iend = this->end();
+ iterator iend = this->end();
size_type len = this->size();
if(len > new_size){
size_type to_erase = len - new_size;
- while(to_erase--){
- --iend;
+ iterator ifirst;
+ if(to_erase < len/2u){
+ ifirst = iend;
+ while(to_erase--){
+ --ifirst;
+ }
}
- this->erase(iend, this->end());
+ else{
+ ifirst = this->begin();
+ size_type to_skip = len - to_erase;
+ while(to_skip--){
+ ++ifirst;
+ }
+ }
+ this->erase(ifirst, iend);
}
else{
this->priv_create_and_insert_nodes(this->end(), new_size - len);
@@ -763,7 +774,7 @@
#else
iterator insert(iterator p, T &&x)
{
- NodePtr tmp = AllocHolder::create_node(move(x));
+ NodePtr tmp = AllocHolder::create_node(detail::move_impl(x));
return iterator(this->icont().insert(p.get(), *tmp));
}
#endif
Modified: trunk/boost/interprocess/containers/map.hpp
==============================================================================
--- trunk/boost/interprocess/containers/map.hpp (original)
+++ trunk/boost/interprocess/containers/map.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -8,7 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
//
-// This file comes from SGI's stl_map/stl_multimap files. Modified by Ion Gazta�ga 2004.
+// This file comes from SGI's stl_map/stl_multimap files. Modified by Ion Gaztanaga.
// Renaming, isolating and porting to generic algorithms. Pointer typedef
// set to allocator::pointer to allow placing it in shared memory.
//
@@ -166,11 +166,11 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
map(const detail::moved_object<map<Key,T,Pred,Alloc> >& x)
- : m_tree(move(x.get().m_tree))
+ : m_tree(detail::move_impl(x.get().m_tree))
{}
#else
map(map<Key,T,Pred,Alloc> &&x)
- : m_tree(move(x.m_tree))
+ : m_tree(detail::move_impl(x.m_tree))
{}
#endif
@@ -185,10 +185,10 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
map<Key,T,Pred,Alloc>& operator=(const detail::moved_object<map<Key,T,Pred,Alloc> >& x)
- { m_tree = move(x.get().m_tree); return *this; }
+ { m_tree = detail::move_impl(x.get().m_tree); return *this; }
#else
map<Key,T,Pred,Alloc>& operator=(map<Key,T,Pred,Alloc> &&x)
- { m_tree = move(x.m_tree); return *this; }
+ { m_tree = detail::move_impl(x.m_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -322,14 +322,14 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
- value_type val(k, move(T()));
- i = insert(i, move(val));
+ value_type val(k, detail::move_impl(T()));
+ i = insert(i, detail::move_impl(val));
}
return (*i).second;
}
//! Effects: If there is no key equivalent to x in the map, inserts
- //! value_type(move(x), T()) into the map (the key is move-constructed)
+ //! value_type(detail::move_impl(x), T()) into the map (the key is move-constructed)
//!
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
@@ -342,8 +342,8 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
- value_type val(k, move(T()));
- i = insert(i, move(val));
+ value_type val(k, detail::move_impl(T()));
+ i = insert(i, detail::move_impl(val));
}
return (*i).second;
}
@@ -355,8 +355,8 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
- value_type val(move(k), move(T()));
- i = insert(i, move(val));
+ value_type val(detail::move_impl(k), detail::move_impl(T()));
+ i = insert(i, detail::move_impl(val));
}
return (*i).second;
}
@@ -364,7 +364,7 @@
/*
//! Effects: If there is no key equivalent to x in the map, inserts
- //! value_type(move(x), T()) into the map (the key is move-constructed)
+ //! value_type(detail::move_impl(x), T()) into the map (the key is move-constructed)
//!
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
@@ -379,8 +379,8 @@
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
- value_type val(k, move(T()));
- i = insert(i, move(val));
+ value_type val(k, detail::move_impl(T()));
+ i = insert(i, detail::move_impl(val));
}
return (*i).second;
}
@@ -449,7 +449,7 @@
{ return m_tree.insert_unique(x); }
#else
std::pair<iterator,bool> insert(std::pair<key_type, mapped_type> &&x)
- { return m_tree.insert_unique(move(x)); }
+ { return m_tree.insert_unique(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Move constructs a new value from x if and only if there is
@@ -465,7 +465,7 @@
{ return m_tree.insert_unique(x); }
#else
std::pair<iterator,bool> insert(value_type &&x)
- { return m_tree.insert_unique(move(x)); }
+ { return m_tree.insert_unique(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -494,7 +494,7 @@
{ return m_tree.insert_unique(position, x); }
#else
iterator insert(iterator position, std::pair<key_type, mapped_type> &&x)
- { return m_tree.insert_unique(position, move(x)); }
+ { return m_tree.insert_unique(position, detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -517,7 +517,7 @@
{ return m_tree.insert_unique(position, x); }
#else
iterator insert(iterator position, value_type &&x)
- { return m_tree.insert_unique(position, move(x)); }
+ { return m_tree.insert_unique(position, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -813,11 +813,11 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
multimap(const detail::moved_object<multimap<Key,T,Pred,Alloc> >& x)
- : m_tree(move(x.get().m_tree))
+ : m_tree(detail::move_impl(x.get().m_tree))
{}
#else
multimap(multimap<Key,T,Pred,Alloc> && x)
- : m_tree(move(x.m_tree))
+ : m_tree(detail::move_impl(x.m_tree))
{}
#endif
@@ -834,11 +834,11 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
multimap<Key,T,Pred,Alloc>&
operator=(const detail::moved_object<multimap<Key,T,Pred,Alloc> >& x)
- { m_tree = move(x.get().m_tree); return *this; }
+ { m_tree = detail::move_impl(x.get().m_tree); return *this; }
#else
multimap<Key,T,Pred,Alloc>&
operator=(multimap<Key,T,Pred,Alloc> && x)
- { m_tree = move(x.m_tree); return *this; }
+ { m_tree = detail::move_impl(x.m_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -1006,7 +1006,7 @@
{ return m_tree.insert_equal(x); }
#else
iterator insert(std::pair<key_type, mapped_type> && x)
- { return m_tree.insert_equal(move(x)); }
+ { return m_tree.insert_equal(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -1044,7 +1044,7 @@
{ return m_tree.insert_equal(position, x); }
#else
iterator insert(iterator position, std::pair<key_type, mapped_type> && x)
- { return m_tree.insert_equal(position, move(x)); }
+ { return m_tree.insert_equal(position, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
Modified: trunk/boost/interprocess/containers/set.hpp
==============================================================================
--- trunk/boost/interprocess/containers/set.hpp (original)
+++ trunk/boost/interprocess/containers/set.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -143,11 +143,11 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
set(const detail::moved_object<set<T,Pred,Alloc> >& x)
- : m_tree(move(x.get().m_tree))
+ : m_tree(detail::move_impl(x.get().m_tree))
{}
#else
set(set<T,Pred,Alloc> &&x)
- : m_tree(move(x.m_tree))
+ : m_tree(detail::move_impl(x.m_tree))
{}
#endif
@@ -162,10 +162,10 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
set<T,Pred,Alloc>& operator=(const detail::moved_object<set<T, Pred, Alloc> >& x)
- { m_tree = move(x.get().m_tree); return *this; }
+ { m_tree = detail::move_impl(x.get().m_tree); return *this; }
#else
set<T,Pred,Alloc>& operator=(set<T, Pred, Alloc> &&x)
- { m_tree = move(x.m_tree); return *this; }
+ { m_tree = detail::move_impl(x.m_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -334,7 +334,7 @@
{ return m_tree.insert_unique(x); }
#else
std::pair<iterator,bool> insert(value_type &&x)
- { return m_tree.insert_unique(move(x)); }
+ { return m_tree.insert_unique(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -360,7 +360,7 @@
{ return m_tree.insert_unique(p, x); }
#else
iterator insert(const_iterator p, value_type &&x)
- { return m_tree.insert_unique(p, move(x)); }
+ { return m_tree.insert_unique(p, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -632,11 +632,11 @@
//! <b>Postcondition</b>: x is emptied.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
multiset(const detail::moved_object<multiset<T,Pred,Alloc> >& x)
- : m_tree(move(x.get().m_tree))
+ : m_tree(detail::move_impl(x.get().m_tree))
{}
#else
multiset(multiset<T,Pred,Alloc> &&x)
- : m_tree(move(x.m_tree))
+ : m_tree(detail::move_impl(x.m_tree))
{}
#endif
@@ -651,10 +651,10 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
multiset<T,Pred,Alloc>& operator=(const detail::moved_object<multiset<T,Pred,Alloc> >& x)
- { m_tree = move(x.get().m_tree); return *this; }
+ { m_tree = detail::move_impl(x.get().m_tree); return *this; }
#else
multiset<T,Pred,Alloc>& operator=(multiset<T,Pred,Alloc> &&x)
- { m_tree = move(x.m_tree); return *this; }
+ { m_tree = detail::move_impl(x.m_tree); return *this; }
#endif
//! <b>Effects</b>: Returns the comparison object out
@@ -818,7 +818,7 @@
{ return m_tree.insert_equal(x); }
#else
iterator insert(value_type && x)
- { return m_tree.insert_equal(move(x)); }
+ { return m_tree.insert_equal(detail::move_impl(x)); }
#endif
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -845,7 +845,7 @@
{ return m_tree.insert_equal(p, x); }
#else
iterator insert(const_iterator p, value_type && x)
- { return m_tree.insert_equal(p, move(x)); }
+ { return m_tree.insert_equal(p, detail::move_impl(x)); }
#endif
//! <b>Requires</b>: i, j are not iterators into *this.
Modified: trunk/boost/interprocess/containers/slist.hpp
==============================================================================
--- trunk/boost/interprocess/containers/slist.hpp (original)
+++ trunk/boost/interprocess/containers/slist.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -87,7 +87,7 @@
#else
template<class Convertible>
slist_node(Convertible &&value)
- : m_data(forward<Convertible>(value)){}
+ : m_data(detail::forward_impl<Convertible>(value)){}
#endif
T m_data;
@@ -321,7 +321,7 @@
{}
// explicit slist(size_type n)
-// : AllocHolder(move(allocator_type()))
+// : AllocHolder(detail::move_impl(allocator_type()))
// { this->resize(n); }
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -367,11 +367,11 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
slist(const detail::moved_object<slist> &x)
- : AllocHolder(move((AllocHolder&)x.get()))
+ : AllocHolder(detail::move_impl((AllocHolder&)x.get()))
{}
#else
slist(slist &&x)
- : AllocHolder(move((AllocHolder&)x))
+ : AllocHolder(detail::move_impl((AllocHolder&)x))
{}
#endif
@@ -594,7 +594,7 @@
{ this->icont().push_front(*this->create_node(x)); }
#else
void push_front(T && x)
- { this->icont().push_front(*this->create_node(move(x))); }
+ { this->icont().push_front(*this->create_node(detail::move_impl(x))); }
#endif
//! <b>Effects</b>: Removes the first element from the list.
@@ -659,7 +659,7 @@
{ return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(x))); }
#else
iterator insert_after(iterator prev_pos, value_type && x)
- { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(move(x)))); }
+ { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(detail::move_impl(x)))); }
#endif
//! <b>Requires</b>: prev_pos must be a valid iterator of *this.
@@ -717,7 +717,7 @@
{ return this->insert_after(previous(p), x); }
#else
iterator insert(iterator p, value_type && x)
- { return this->insert_after(previous(p), move(x)); }
+ { return this->insert_after(previous(p), detail::move_impl(x)); }
#endif
//! <b>Requires</b>: p must be a valid iterator of *this.
Modified: trunk/boost/interprocess/containers/string.hpp
==============================================================================
--- trunk/boost/interprocess/containers/string.hpp (original)
+++ trunk/boost/interprocess/containers/string.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -281,7 +281,7 @@
(void)limit_size;
(void)reuse;
if(!(command & allocate_new))
- return std::pair<pointer, bool>(0, 0);
+ return std::pair<pointer, bool>(pointer(0), 0);
received_size = preferred_size;
return std::make_pair(this->alloc().allocate(received_size), false);
}
@@ -551,11 +551,11 @@
//! <b>Complexity</b>: Constant.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
basic_string(const detail::moved_object<basic_string>& s)
- : base_t(move((base_t&)s.get()))
+ : base_t(detail::move_impl((base_t&)s.get()))
{}
#else
basic_string(basic_string && s)
- : base_t(move((base_t&)s))
+ : base_t(detail::move_impl((base_t&)s))
{}
#endif
@@ -1940,7 +1940,7 @@
const basic_string<CharT,Traits,A>& y)
{
mx += y;
- return move(mx);
+ return detail::move_impl(mx);
}
#endif
@@ -1994,7 +1994,7 @@
basic_string<CharT,Traits,A> && my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
- return move(my.get().replace(size_type(0), size_type(0), s));
+ return detail::move_impl(my.get().replace(size_type(0), size_type(0), s));
}
#endif
@@ -2061,7 +2061,7 @@
const CharT* s)
{
mx += s;
- return move(mx);
+ return detail::move_impl(mx);
}
#endif
@@ -2093,7 +2093,7 @@
operator+(basic_string<CharT,Traits,A> && mx, const CharT c)
{
mx += c;
- return move(mx);
+ return detail::move_impl(mx);
}
#endif
Modified: trunk/boost/interprocess/containers/vector.hpp
==============================================================================
--- trunk/boost/interprocess/containers/vector.hpp (original)
+++ trunk/boost/interprocess/containers/vector.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -288,7 +288,7 @@
(void)limit_size;
(void)reuse;
if(!(command & allocate_new))
- return std::pair<pointer, bool>(0, 0);
+ return std::pair<pointer, bool>(pointer(0), 0);
received_size = preferred_size;
return std::make_pair(this->alloc().allocate(received_size), false);
}
@@ -491,7 +491,7 @@
{ this->swap(mx.get()); }
#else
vector(vector<T, A> && mx)
- : base_t(mx)
+ : base_t(detail::move_impl(mx))
{ this->swap(mx); }
#endif
@@ -890,11 +890,11 @@
{
if (this->members_.m_size < this->members_.m_capacity){
//There is more memory, just construct a new object at the end
- new((void*)detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(move(mx));
+ new((void*)detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(detail::move_impl(mx));
++this->members_.m_size;
}
else{
- this->insert(this->end(), move(mx));
+ this->insert(this->end(), detail::move_impl(mx));
}
}
#endif
@@ -1719,8 +1719,9 @@
//Backup old buffer data
size_type old_offset = old_start - detail::get_pointer(ret.first);
size_type first_count = min_value(n, old_offset);
- FwdIt mid = boost::interprocess::n_uninitialized_copy_n
+ boost::interprocess::uninitialized_copy_n
(first, first_count, detail::get_pointer(ret.first));
+ FwdIt mid = first + first_count;
if(old_offset > n){
//All old elements will be destroyed by "old_values_destroyer"
@@ -1734,12 +1735,13 @@
this->members_.m_size = first_count + old_size;
//Now overwrite the old values
size_type second_count = min_value(old_size, n - first_count);
- mid = copy_n(mid, second_count, old_start);
+ copy_n(mid, second_count, old_start);
+ mid += second_count;
//Check if we still have to append elements in the
//uninitialized end
if(second_count == old_size){
- boost::interprocess::n_uninitialized_copy_n
+ boost::interprocess::uninitialized_copy_n
( mid
, n - first_count - second_count
, old_start + old_size);
Modified: trunk/boost/interprocess/detail/algorithms.hpp
==============================================================================
--- trunk/boost/interprocess/detail/algorithms.hpp (original)
+++ trunk/boost/interprocess/detail/algorithms.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -20,8 +20,12 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/iterators.hpp>
-#include <boost/get_pointer.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/get_pointer.hpp>
+#include <cstring>
namespace boost {
namespace interprocess {
@@ -62,18 +66,67 @@
}
template<class InIt, class OutIt>
-InIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
+struct optimize_assign
+{
+ static const bool value = false;
+};
+
+template<class T>
+struct optimize_assign<const T*, T*>
+{
+ static const bool value = boost::has_trivial_assign<T>::value;
+};
+
+template<class T>
+struct optimize_assign<T*, T*>
+ : public optimize_assign<const T*, T*>
+{};
+
+template<class InIt, class OutIt>
+struct optimize_copy
+{
+ static const bool value = false;
+};
+
+template<class T>
+struct optimize_copy<const T*, T*>
+{
+ static const bool value = boost::has_trivial_copy<T>::value;
+};
+
+template<class T>
+struct optimize_copy<T*, T*>
+ : public optimize_copy<const T*, T*>
+{};
+
+
+template<class InIt, class OutIt> inline
+OutIt copy_n_dispatch(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest, detail::bool_<false>)
{
for (; length--; ++dest, ++first)
*dest = *first;
- return first;
+ return dest;
+}
+
+template<class T> inline
+T *copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, detail::bool_<true>)
+{
+ std::size_t size = length*sizeof(T);
+ return ((T*)std::memmove(dest, first, size)) + size;
+}
+
+template<class InIt, class OutIt> inline
+OutIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
+{
+ const bool do_optimized_assign = optimize_assign<InIt, OutIt>::value;
+ return copy_n_dispatch(first, length, dest, detail::bool_<do_optimized_assign>());
}
template<class InIt, class FwdIt> inline
-InIt n_uninitialized_copy_n
+FwdIt uninitialized_copy_n_dispatch
(InIt first,
typename std::iterator_traits<InIt>::difference_type count,
- FwdIt dest)
+ FwdIt dest, detail::bool_<false>)
{
typedef typename std::iterator_traits<FwdIt>::value_type value_type;
//Save initial destination position
@@ -95,9 +148,28 @@
BOOST_RETHROW
}
BOOST_CATCH_END
- return first;
+ return dest;
}
+
+template<class T> inline
+T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, detail::bool_<true>)
+{
+ std::size_t size = length*sizeof(T);
+ return ((T*)std::memmove(dest, first, size)) + size;
+}
+
+template<class InIt, class FwdIt> inline
+FwdIt uninitialized_copy_n
+ (InIt first,
+ typename std::iterator_traits<InIt>::difference_type count,
+ FwdIt dest)
+{
+ const bool do_optimized_copy = optimize_copy<InIt, FwdIt>::value;
+ return uninitialized_copy_n_dispatch(first, count, dest, detail::bool_<do_optimized_copy>());
+}
+
+
// uninitialized_copy_copy
// Copies [first1, last1) into [result, result + (last1 - first1)), and
// copies [first2, last2) into
Modified: trunk/boost/interprocess/detail/file_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/file_wrapper.hpp (original)
+++ trunk/boost/interprocess/detail/file_wrapper.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -72,7 +72,7 @@
#else
file_wrapper &operator=(file_wrapper &&moved)
{
- file_wrapper tmp(move(moved));
+ file_wrapper tmp(detail::move_impl(moved));
this->swap(tmp);
return *this;
}
Modified: trunk/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_memory_impl.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -94,6 +94,8 @@
/// @cond
+ typedef typename
+ segment_manager::char_ptr_holder_t char_ptr_holder_t;
//Experimental. Don't use.
typedef typename segment_manager::multiallocation_iterator multiallocation_iterator;
@@ -105,9 +107,6 @@
private:
typedef basic_managed_memory_impl
<CharType, MemoryAlgorithm, IndexType, Offset> self_t;
- typedef typename
- segment_manager::char_ptr_holder_t char_ptr_holder_t;
-
protected:
template<class ManagedMemory>
static bool grow(const char *filename, std::size_t extra_bytes)
@@ -687,6 +686,15 @@
get_deleter()
{ return mp_header->get_deleter<T>(); }
+ /// @cond
+ //!Tries to find a previous named allocation address. Returns a memory
+ //!buffer and the object count. If not found returned pointer is 0.
+ //!Never throws.
+ template <class T>
+ std::pair<T*, std::size_t> find_no_lock (char_ptr_holder_t name)
+ { return mp_header->template find_no_lock<T>(name); }
+ /// @endcond
+
protected:
//!Swaps the segment manager's managed by this managed memory segment.
//!NOT thread-safe. Never throws.
Modified: trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -117,7 +117,7 @@
shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin();
return result_type(m_impl.get_real_address(), m_impl.get_real_size()-1);
}
- return result_type(0, 0);
+ return result_type((void *)0, 0);
}
virtual bool update_segments ()
@@ -174,8 +174,8 @@
//Check if this is the master segment
if(!m_segment_number){
//Create or open the Interprocess machinery
- if(impl_done = created ?
- mp_frontend->create_impl(addr, size) : mp_frontend->open_impl(addr, size)){
+ if((impl_done = created ?
+ mp_frontend->create_impl(addr, size) : mp_frontend->open_impl(addr, size))){
return true;
}
}
@@ -315,21 +315,21 @@
case create_open_func::DoCreate:
{
managed_impl shm(create_only, name, size, read_write, addr, func);
- mshm = move(shm);
+ mshm = detail::move_impl(shm);
}
break;
case create_open_func::DoOpen:
{
managed_impl shm(open_only, name,read_write, addr, func);
- mshm = move(shm);
+ mshm = detail::move_impl(shm);
}
break;
case create_open_func::DoOpenOrCreate:
{
managed_impl shm(open_or_create, name, size, read_write, addr, func);
- mshm = move(shm);
+ mshm = detail::move_impl(shm);
}
break;
@@ -339,7 +339,7 @@
}
//This can throw.
- m_shmem_list.push_back(move(mshm));
+ m_shmem_list.push_back(detail::move_impl(mshm));
return true;
}
BOOST_CATCH(const std::bad_alloc&){
Modified: trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -176,7 +176,7 @@
#else
managed_open_or_create_impl &operator=(managed_open_or_create_impl &&moved)
{
- managed_open_or_create_impl tmp(move(moved));
+ managed_open_or_create_impl tmp(detail::move_impl(moved));
this->swap(tmp);
return *this;
}
@@ -209,6 +209,10 @@
bool flush()
{ return m_mapped_region.flush(); }
+
+ const mapped_region &get_mapped_region() const
+ { return m_mapped_region; }
+
private:
//These are templatized to allow explicit instantiations
Modified: trunk/boost/interprocess/detail/math_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/math_functions.hpp (original)
+++ trunk/boost/interprocess/detail/math_functions.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -16,7 +16,6 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
#define BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
-#include <boost/static_assert.hpp>
#include <climits>
namespace boost {
Modified: trunk/boost/interprocess/detail/move.hpp
==============================================================================
--- trunk/boost/interprocess/detail/move.hpp (original)
+++ trunk/boost/interprocess/detail/move.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -17,6 +17,8 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/interprocess_fwd.hpp>
+#include <boost/interprocess/detail/mpl.hpp>
//!\file
//!Describes a function and a type to emulate move semantics.
@@ -106,16 +108,25 @@
namespace boost {
namespace interprocess {
+namespace detail{
+
//!A function that converts an object to a moved object so that
//!it can match a function taking a detail::moved_object object.
template<class Object>
-typename detail::move_type<Object>::type move
- (const Object &object)
+typename detail::move_type<Object>::type move_impl(const Object &object)
{
typedef typename detail::move_type<Object>::type type;
return type(object);
}
+} //namespace detail {
+
+//!A function that converts an object to a moved object so that
+//!it can match a function taking a detail::moved_object object.
+template<class Object>
+typename detail::move_type<Object>::type move(const Object &object)
+{ return detail::move_impl(object); }
+
} //namespace interprocess {
} //namespace boost {
@@ -126,15 +137,20 @@
namespace boost {
namespace interprocess {
+namespace detail {
+
template <class T>
-inline typename detail::remove_reference<T>::type&&
-move(T&& t)
+inline typename detail::remove_reference<T>::type&& move_impl(T&& t)
{ return t; }
template <class T>
-inline
-T&&
-forward(typename identity<T>::type&& t)
+inline T&& forward_impl(typename detail::identity<T>::type&& t)
+{ return t; }
+
+} //namespace detail {
+
+template <class T>
+inline typename detail::remove_reference<T>::type&& move(T&& t)
{ return t; }
} //namespace interprocess {
Modified: trunk/boost/interprocess/detail/move_iterator.hpp
==============================================================================
--- trunk/boost/interprocess/detail/move_iterator.hpp (original)
+++ trunk/boost/interprocess/detail/move_iterator.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -53,7 +53,7 @@
reference operator*() const
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- { return move(*m_it); }
+ { return detail::move_impl(*m_it); }
#else
{ return *m_it; }
#endif
@@ -86,7 +86,7 @@
{ m_it -= n; return *this; }
reference operator[](difference_type n) const
- { return move(m_it[n]); }
+ { return detail::move_impl(m_it[n]); }
private:
It m_it;
Modified: trunk/boost/interprocess/detail/mpl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/mpl.hpp (original)
+++ trunk/boost/interprocess/detail/mpl.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -117,6 +117,7 @@
struct identity
// : public std::unary_function<T,T>
{
+ typedef T type;
const T& operator()(const T& x) const
{ return x; }
};
Modified: trunk/boost/interprocess/detail/utilities.hpp
==============================================================================
--- trunk/boost/interprocess/detail/utilities.hpp (original)
+++ trunk/boost/interprocess/detail/utilities.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -526,61 +526,61 @@
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template <class D, class S>
pair(const detail::moved_object<std::pair<D, S> >& p)
- : first(move(p.get().first)), second(move(p.get().second))
+ : first(detail::move_impl(p.get().first)), second(detail::move_impl(p.get().second))
{}
#else
template <class D, class S>
pair(std::pair<D, S> && p)
- : first(move(p.first)), second(move(p.second))
+ : first(detail::move_impl(p.first)), second(detail::move_impl(p.second))
{}
#endif
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template <class D, class S>
pair(const detail::moved_object<pair<D, S> >& p)
- : first(move(p.get().first)), second(move(p.get().second))
+ : first(detail::move_impl(p.get().first)), second(detail::move_impl(p.get().second))
{}
#else
template <class D, class S>
pair(pair<D, S> && p)
- : first(move(p.first)), second(move(p.second))
+ : first(detail::move_impl(p.first)), second(detail::move_impl(p.second))
{}
#endif
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
template <class U, class V>
pair(const detail::moved_object<U> &x, const detail::moved_object<V> &y)
- : first(move(x.get())), second(move(y.get()))
+ : first(detail::move_impl(x.get())), second(detail::move_impl(y.get()))
{}
#else
template <class U, class V>
pair(U &&x, V &&y)
- : first(move(x)), second(move(y))
+ : first(detail::move_impl(x)), second(detail::move_impl(y))
{}
#endif
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
pair(const detail::moved_object<pair> &p)
- : first(move(p.get().first)), second(move(p.get().second))
+ : first(detail::move_impl(p.get().first)), second(detail::move_impl(p.get().second))
{}
#else
pair(pair &&p)
- : first(move(p.first)), second(move(p.second))
+ : first(detail::move_impl(p.first)), second(detail::move_impl(p.second))
{}
#endif
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
pair& operator=(const detail::moved_object<pair> &p)
{
- first = move(p.get().first);
- second = move(p.get().second);
+ first = detail::move_impl(p.get().first);
+ second = detail::move_impl(p.get().second);
return *this;
}
#else
pair& operator=(pair &&p)
{
- first = move(p.first);
- second = move(p.second);
+ first = detail::move_impl(p.first);
+ second = detail::move_impl(p.second);
return *this;
}
#endif
@@ -596,16 +596,16 @@
template <class D, class S>
pair& operator=(const detail::moved_object<std::pair<D, S> > &p)
{
- first = move(p.get().first);
- second = move(p.get().second);
+ first = detail::move_impl(p.get().first);
+ second = detail::move_impl(p.get().second);
return *this;
}
#else
template <class D, class S>
pair& operator=(std::pair<D, S> &&p)
{
- first = move(p.first);
- second = move(p.second);
+ first = detail::move_impl(p.first);
+ second = detail::move_impl(p.second);
return *this;
}
#endif
@@ -785,6 +785,36 @@
bool m_erase;
};
+template <class T>
+struct sizeof_value
+{
+ static const std::size_t value = sizeof(T);
+};
+
+template <>
+struct sizeof_value<void>
+{
+ static const std::size_t value = sizeof(void*);
+};
+
+template <>
+struct sizeof_value<const void>
+{
+ static const std::size_t value = sizeof(void*);
+};
+
+template <>
+struct sizeof_value<volatile void>
+{
+ static const std::size_t value = sizeof(void*);
+};
+
+template <>
+struct sizeof_value<const volatile void>
+{
+ static const std::size_t value = sizeof(void*);
+};
+
} //namespace interprocess {
} //namespace boost {
Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -225,7 +225,7 @@
extern "C" __declspec(dllimport) void * __stdcall CreateFileMappingA (void *, interprocess_security_attributes*, unsigned long, unsigned long, unsigned long, const char *);
extern "C" __declspec(dllimport) void * __stdcall MapViewOfFileEx (void *, unsigned long, unsigned long, unsigned long, std::size_t, void*);
extern "C" __declspec(dllimport) void * __stdcall OpenFileMappingA (unsigned long, int, const char *);
-extern "C" __declspec(dllimport) void * __stdcall CreateFileA (const char *, unsigned long, unsigned long, struct _SECURITY_ATTRIBUTES*, unsigned long, unsigned long, void *);
+extern "C" __declspec(dllimport) void * __stdcall CreateFileA (const char *, unsigned long, unsigned long, struct interprocess_security_attributes*, unsigned long, unsigned long, void *);
extern "C" __declspec(dllimport) int __stdcall DeleteFileA (const char *);
extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *);
extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::size_t);
Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -13,6 +13,8 @@
#include <boost/interprocess/detail/config_begin.hpp>
+#undef BOOST_DISABLE_WIN32
+
#if !(defined BOOST_WINDOWS) || (defined BOOST_DISABLE_WIN32)
#include <unistd.h>
Modified: trunk/boost/interprocess/file_mapping.hpp
==============================================================================
--- trunk/boost/interprocess/file_mapping.hpp (original)
+++ trunk/boost/interprocess/file_mapping.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -79,7 +79,7 @@
#else
file_mapping &operator=(file_mapping &&moved)
{
- file_mapping tmp(move(moved));
+ file_mapping tmp(detail::move_impl(moved));
this->swap(tmp);
return *this;
}
@@ -180,6 +180,22 @@
///@endcond
+//!A class that stores the name of a a file
+//!and call std::remove(name) in its destructor
+//!Useful to remove temporary files in the presence
+//!of exceptions
+class remove_file_on_destroy
+{
+ const char * m_name;
+ public:
+ remove_file_on_destroy(const char *name)
+ : m_name(name)
+ {}
+
+ ~remove_file_on_destroy()
+ { std::remove(m_name); }
+};
+
} //namespace interprocess {
} //namespace boost {
Modified: trunk/boost/interprocess/managed_mapped_file.hpp
==============================================================================
--- trunk/boost/interprocess/managed_mapped_file.hpp (original)
+++ trunk/boost/interprocess/managed_mapped_file.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -22,6 +22,7 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/file_wrapper.hpp>
#include <boost/interprocess/detail/move.hpp>
+#include <boost/interprocess/file_mapping.hpp>
namespace boost {
namespace interprocess {
@@ -54,6 +55,9 @@
basic_managed_mapped_file *get_this_pointer()
{ return this; }
+
+ private:
+ typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
/// @endcond
public: //functions
@@ -102,6 +106,16 @@
detail::DoOpen))
{}
+ //!Connects to a created mapped file and its segment manager
+ //!in read-only mode.
+ //!This can throw.
+ basic_managed_mapped_file (open_read_only_t, const char* name,
+ const void *addr = 0)
+ : m_mfile(open_only, name, read_only, addr,
+ create_open_func_t(get_this_pointer(),
+ detail::DoOpen))
+ {}
+
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
@@ -168,6 +182,21 @@
}
/// @cond
+
+ //!Tries to find a previous named allocation address. Returns a memory
+ //!buffer and the object count. If not found returned pointer is 0.
+ //!Never throws.
+ template <class T>
+ std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ {
+ if(m_mfile.get_mapped_region().get_mode() == read_only){
+ return base_t::template find_no_lock<T>(name);
+ }
+ else{
+ return base_t::template find<T>(name);
+ }
+ }
+
private:
managed_open_or_create_type m_mfile;
/// @endcond
Modified: trunk/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_shared_memory.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -57,6 +57,9 @@
basic_managed_shared_memory *get_this_pointer()
{ return this; }
+
+ private:
+ typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
/// @endcond
public: //functions
@@ -109,6 +112,17 @@
{}
//!Connects to a created shared memory and its segment manager.
+ //!in read-only mode.
+ //!This can throw.
+ basic_managed_shared_memory (open_read_only_t, const char* name,
+ const void *addr = 0)
+ : base_t()
+ , base2_t(open_only, name, read_only, addr,
+ create_open_func_t(get_this_pointer(),
+ detail::DoOpen))
+ {}
+
+ //!Connects to a created shared memory and its segment manager.
//!This can throw.
basic_managed_shared_memory (open_only_t open_only, const char* name,
const void *addr = 0)
@@ -168,6 +182,24 @@
return base_t::template shrink_to_fit
<basic_managed_shared_memory>(filename);
}
+
+ /// @cond
+
+ //!Tries to find a previous named allocation address. Returns a memory
+ //!buffer and the object count. If not found returned pointer is 0.
+ //!Never throws.
+ template <class T>
+ std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ {
+ if(base2_t::get_mapped_region().get_mode() == read_only){
+ return base_t::template find_no_lock<T>(name);
+ }
+ else{
+ return base_t::template find<T>(name);
+ }
+ }
+
+ /// @endcond
};
///@cond
Modified: trunk/boost/interprocess/managed_windows_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_windows_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_windows_shared_memory.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -57,6 +57,9 @@
basic_managed_windows_shared_memory *get_this_pointer()
{ return this; }
+
+ private:
+ typedef typename base_t::char_ptr_holder_t char_ptr_holder_t;
/// @endcond
public: //functions
@@ -90,8 +93,8 @@
//!Connects to a created shared memory and its segment manager.
//!This can throw.
- basic_managed_windows_shared_memory (open_only_t open_only, const char* name,
- const void *addr = 0)
+ basic_managed_windows_shared_memory
+ (open_only_t open_only, const char* name, const void *addr = 0)
: m_wshm(open_only, name, read_write, addr,
create_open_func_t(get_this_pointer(),
detail::DoOpen))
@@ -100,11 +103,20 @@
//!Connects to a created shared memory and its segment manager
//!in copy_on_write mode.
//!This can throw.
- basic_managed_windows_shared_memory (open_copy_on_write_t, const char* name,
- const void *addr = 0)
+ basic_managed_windows_shared_memory
+ (open_copy_on_write_t, const char* name, const void *addr = 0)
: m_wshm(open_only, name, copy_on_write, addr,
- create_open_func_t(get_this_pointer(),
- detail::DoOpen))
+ create_open_func_t(get_this_pointer(), detail::DoOpen))
+ {}
+
+ //!Connects to a created shared memory and its segment manager
+ //!in read-only mode.
+ //!This can throw.
+ basic_managed_windows_shared_memory
+ (open_read_only_t, const char* name, const void *addr = 0)
+ : base_t()
+ , m_wshm(open_only, name, read_only, addr,
+ create_open_func_t(get_this_pointer(), detail::DoOpen))
{}
//!Moves the ownership of "moved"'s managed memory to *this.
@@ -146,6 +158,21 @@
m_wshm.swap(other.m_wshm);
}
/// @cond
+
+ //!Tries to find a previous named allocation address. Returns a memory
+ //!buffer and the object count. If not found returned pointer is 0.
+ //!Never throws.
+ template <class T>
+ std::pair<T*, std::size_t> find (char_ptr_holder_t name)
+ {
+ if(m_wshm.get_mapped_region().get_mode() == read_only){
+ return base_t::template find_no_lock<T>(name);
+ }
+ else{
+ return base_t::template find<T>(name);
+ }
+ }
+
private:
detail::managed_open_or_create_impl<windows_shared_memory, false> m_wshm;
/// @endcond
Modified: trunk/boost/interprocess/mapped_region.hpp
==============================================================================
--- trunk/boost/interprocess/mapped_region.hpp (original)
+++ trunk/boost/interprocess/mapped_region.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -109,6 +109,10 @@
//!mapped memory. Never throws.
offset_t get_offset() const;
+ //!Returns the mode of the mapping used to contruct the mapped file.
+ //!Never throws.
+ mode_t get_mode() const;
+
//!Flushes to the disk a byte range within the mapped memory.
//!Never throws
bool flush(std::size_t mapping_offset = 0, std::size_t numbytes = 0);
@@ -137,6 +141,7 @@
std::size_t m_size;
offset_t m_offset;
offset_t m_extra_offset;
+ mode_t m_mode;
#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
file_handle_t m_file_mapping_hnd;
#endif
@@ -164,16 +169,19 @@
inline std::size_t mapped_region::get_size() const
{ return m_size; }
-inline offset_t mapped_region::get_offset() const
+inline offset_t mapped_region::get_offset() const
{ return m_offset; }
+inline mode_t mapped_region::get_mode() const
+{ return m_mode; }
+
inline void* mapped_region::get_address() const
{ return m_base; }
#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
inline mapped_region::mapped_region()
- : m_base(0), m_size(0), m_offset(0), m_extra_offset(0)
+ : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only)
, m_file_mapping_hnd(detail::invalid_file())
{}
@@ -181,12 +189,14 @@
inline mapped_region::mapped_region(detail::moved_object<mapped_region> other)
: m_base(0), m_size(0), m_offset(0)
, m_extra_offset(0)
+ , m_mode(read_only)
, m_file_mapping_hnd(detail::invalid_file())
{ this->swap(other.get()); }
#else
inline mapped_region::mapped_region(mapped_region &&other)
: m_base(0), m_size(0), m_offset(0)
, m_extra_offset(0)
+ , m_mode(read_only)
, m_file_mapping_hnd(detail::invalid_file())
{ this->swap(other); }
#endif
@@ -206,7 +216,7 @@
,offset_t offset
,std::size_t size
,const void *address)
- : m_base(0), m_size(0), m_offset(0), m_extra_offset(0)
+ : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode)
, m_file_mapping_hnd(detail::invalid_file())
{
mapping_handle_t mhandle = mapping.get_mapping_handle();
@@ -378,16 +388,16 @@
#else //#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
inline mapped_region::mapped_region()
- : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0)
+ : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only)
{}
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
inline mapped_region::mapped_region(detail::moved_object<mapped_region> other)
- : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0)
+ : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only)
{ this->swap(other.get()); }
#else
inline mapped_region::mapped_region(mapped_region &&other)
- : m_base(MAP_FAILED), m_size(0), m_offset(0)
+ : m_base(MAP_FAILED), m_size(0), m_offset(0), m_mode(read_only)
, m_extra_offset(0)
{ this->swap(other); }
#endif
@@ -403,7 +413,7 @@
offset_t offset,
std::size_t size,
const void *address)
- : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0)
+ : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode)
{
if(size == 0){
// offset_t filesize = lseek64
@@ -540,6 +550,7 @@
detail::do_swap(this->m_size, other.m_size);
detail::do_swap(this->m_offset, other.m_offset);
detail::do_swap(this->m_extra_offset, other.m_extra_offset);
+ detail::do_swap(this->m_mode, other.m_mode);
#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
detail::do_swap(this->m_file_mapping_hnd, other.m_file_mapping_hnd);
#endif
Modified: trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -577,7 +577,7 @@
void *reuse_ptr, std::size_t sizeof_object)
{
if(!sizeof_object)
- return std::pair<void *, bool>(0, 0);
+ return std::pair<void *, bool>((void*)0, 0);
if(command & try_shrink_in_place){
bool success = algo_impl_t::try_shrink
( this, reuse_ptr, limit_objects*sizeof_object
@@ -596,7 +596,7 @@
void *reuse_ptr, std::size_t sizeof_object)
{
command &= ~expand_bwd;
- if(!command) return std::pair<void *, bool>(0, false);
+ if(!command) return std::pair<void *, bool>((void*)0, false);
std::pair<void*, bool> ret;
std::size_t max_count = m_header.m_size/sizeof_object;
@@ -769,7 +769,7 @@
received_size = 0;
if(limit_size > preferred_size)
- return return_type(0, false);
+ return return_type((void*)0, false);
//Number of units to request (including block_ctrl header)
std::size_t nunits = detail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlUnits;
@@ -819,7 +819,7 @@
if(biggest_block){
std::size_t limit_units = detail::get_rounded_size(limit_size, Alignment)/Alignment + BlockCtrlUnits;
if(biggest_block->m_size < limit_units)
- return return_type(0, false);
+ return return_type((void*)0, false);
received_size = biggest_block->m_size*Alignment - BlockCtrlUnits;
void *ret = this->priv_check_and_allocate
@@ -836,7 +836,7 @@
algo_impl_t::assert_alignment(ret.first);
return ret;
}
- return return_type(0, false);
+ return return_type((void*)0, false);
}
template<class MutexFamily, class VoidPointer> inline
@@ -888,13 +888,13 @@
}
if(prev_block == root || !prev_block->m_next)
- return prev_pair_t(0, 0);
+ return prev_pair_t((block_ctrl*)0, (block_ctrl*)0);
//Check if the previous block is in the managed segment
std::size_t distance = (detail::char_ptr_cast(prev_block) - detail::char_ptr_cast(this))/Alignment;
if(distance >= (m_header.m_size/Alignment)){
//"previous_block" does not exist so we can't expand "block"
- return prev_pair_t(0, 0);
+ return prev_pair_t((block_ctrl*)0, (block_ctrl*)0);
}
return prev_pair_t(prev_2_block, prev_block);
}
Modified: trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -664,7 +664,7 @@
void *reuse_ptr, std::size_t sizeof_object)
{
if(!sizeof_object)
- return std::pair<void *, bool>(0, 0);
+ return std::pair<void *, bool>((void *)0, 0);
if(command & try_shrink_in_place){
bool success = algo_impl_t::try_shrink
( this, reuse_ptr, limit_objects*sizeof_object
@@ -930,7 +930,7 @@
received_size = 0;
if(limit_size > preferred_size)
- return return_type(0, false);
+ return return_type((void*)0, false);
//Number of units to request (including block_ctrl header)
std::size_t preferred_units = priv_get_total_units(preferred_size);
@@ -969,7 +969,7 @@
(command, limit_size, preferred_size, received_size, reuse_ptr, false, backwards_multiple), true);
}
- return return_type(0, false);
+ return return_type((void*)0, false);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
Modified: trunk/boost/interprocess/segment_manager.hpp
==============================================================================
--- trunk/boost/interprocess/segment_manager.hpp (original)
+++ trunk/boost/interprocess/segment_manager.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -32,6 +32,8 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/smart_ptr/deleter.hpp>
+#include <boost/interprocess/detail/move.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
#include <cstddef> //std::size_t
#include <string> //char_traits
#include <new> //std::nothrow
@@ -292,7 +294,7 @@
block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment);
//-------------------------------
- //boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ //scoped_lock<rmutex> guard(m_header);
//-------------------------------
if(ctrl_data->allocation_type() != anonymous_type){
@@ -423,10 +425,10 @@
void *ret;
if(name == reinterpret_cast<const CharType*>(-1)){
- ret = priv_generic_find<char> (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t());
+ ret = priv_generic_find<char> (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), true);
}
else{
- ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t());
+ ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t(), true);
}
return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
}
@@ -439,7 +441,7 @@
{
detail::placement_destroy<T> table;
std::size_t size;
- void *ret = priv_generic_find<char>(name, m_header.m_unique_index, table, size, is_intrusive_t());
+ void *ret = priv_generic_find<char>(name, m_header.m_unique_index, table, size, is_intrusive_t(), true);
return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
}
@@ -502,7 +504,7 @@
//!executing the object function call*/
template <class Func>
void atomic_func(Func &f)
- { boost::interprocess::scoped_lock<rmutex> guard(m_header); f(); }
+ { scoped_lock<rmutex> guard(m_header); f(); }
//!Destroys a previously created unique instance.
//!Returns false if the object was not present.
@@ -559,7 +561,7 @@
void reserve_named_objects(std::size_t num)
{
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
m_header.m_named_index.reserve(num);
}
@@ -570,7 +572,7 @@
void reserve_unique_objects(std::size_t num)
{
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
m_header.m_unique_index.reserve(num);
}
@@ -580,7 +582,7 @@
void shrink_to_fit_indexes()
{
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
m_header.m_named_index.shrink_to_fit();
m_header.m_unique_index.shrink_to_fit();
@@ -591,7 +593,7 @@
std::size_t get_num_named_objects()
{
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
return m_header.m_named_index.size();
}
@@ -601,7 +603,7 @@
std::size_t get_num_unique_objects()
{
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
return m_header.m_unique_index.size();
}
@@ -688,6 +690,39 @@
(priv_generic_construct(name, num, try2find, dothrow, table));
}
+ //!Tries to find a previous named allocation. Returns the address
+ //!and the object count. On failure the first member of the
+ //!returned pair is 0.
+ template <class T>
+ std::pair<T*, std::size_t> find_no_lock (const CharType* name)
+ {
+ //The name can't be null, no anonymous object can be found by name
+ assert(name != 0);
+ detail::placement_destroy<T> table;
+ std::size_t size;
+ void *ret;
+
+ if(name == reinterpret_cast<const CharType*>(-1)){
+ ret = priv_generic_find<char> (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), false);
+ }
+ else{
+ ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t(), false);
+ }
+ return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
+ }
+
+ //!Tries to find a previous unique allocation. Returns the address
+ //!and the object count. On failure the first member of the
+ //!returned pair is 0.
+ template <class T>
+ std::pair<T*, std::size_t> find_no_lock (const detail::unique_instance_t* name)
+ {
+ detail::placement_destroy<T> table;
+ std::size_t size;
+ void *ret = priv_generic_find<char>(name, m_header.m_unique_index, table, size, is_intrusive_t(), false);
+ return std::pair<T*, std::size_t>(static_cast<T*>(ret), size);
+ }
+
private:
void *priv_generic_construct(const CharType *name,
std::size_t num,
@@ -790,7 +825,8 @@
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
std::size_t &length,
- detail::true_ is_intrusive)
+ detail::true_ is_intrusive,
+ bool use_lock)
{
(void)is_intrusive;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
@@ -798,7 +834,7 @@
typedef typename index_type::iterator index_it;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(priv_get_lock(use_lock));
//-------------------------------
//Find name in index
detail::intrusive_compare_key<CharT> key
@@ -829,7 +865,8 @@
IndexType<detail::index_config<CharT, MemoryAlgorithm> > &index,
detail::in_place_interface &table,
std::size_t &length,
- detail::false_ is_intrusive)
+ detail::false_ is_intrusive,
+ bool use_lock)
{
(void)is_intrusive;
typedef IndexType<detail::index_config<CharT, MemoryAlgorithm> > index_type;
@@ -837,7 +874,7 @@
typedef typename index_type::iterator index_it;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(priv_get_lock(use_lock));
//-------------------------------
//Find name in index
index_it it = index.find(key_type(name, std::char_traits<CharT>::length(name)));
@@ -900,7 +937,7 @@
typedef typename index_type::value_type intrusive_value_type;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
//Find name in index
detail::intrusive_compare_key<CharT> key
@@ -950,7 +987,7 @@
typedef typename index_type::key_type key_type;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
//Try to find the name in the index
index_it it = index.find(key_type (name,
@@ -1038,7 +1075,7 @@
typedef std::pair<index_it, bool> index_ib;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
//Insert the node. This can throw.
//First, we want to know if the key is already present before
@@ -1164,7 +1201,7 @@
typedef std::pair<index_it, bool> index_ib;
//-------------------------------
- boost::interprocess::scoped_lock<rmutex> guard(m_header);
+ scoped_lock<rmutex> guard(m_header);
//-------------------------------
//Insert the node. This can throw.
//First, we want to know if the key is already present before
@@ -1272,6 +1309,20 @@
typedef typename MemoryAlgorithm::mutex_family::recursive_mutex_type rmutex;
+ #ifdef BOOST_INTERPROCESS_RVALUE_REFERENCE
+ scoped_lock<rmutex>
+ #else
+ detail::move_return<scoped_lock<rmutex> >
+ #endif
+ priv_get_lock(bool use_lock)
+ {
+ scoped_lock<rmutex> local(m_header, defer_lock);
+ if(use_lock){
+ local.lock();
+ }
+ return local;
+ }
+
//!This struct includes needed data and derives from
//!rmutex to allow EBO when using null interprocess_mutex
struct header_t
Modified: trunk/boost/interprocess/shared_memory_object.hpp
==============================================================================
--- trunk/boost/interprocess/shared_memory_object.hpp (original)
+++ trunk/boost/interprocess/shared_memory_object.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -99,7 +99,7 @@
#else
shared_memory_object &operator=(shared_memory_object &&moved)
{
- shared_memory_object tmp(move(moved));
+ shared_memory_object tmp(detail::move_impl(moved));
this->swap(tmp);
return *this;
}
@@ -355,6 +355,22 @@
///@endcond
+//!A class that stores the name of a shared memory
+//!and calls shared_memory_object::remove(name) in its destructor
+//!Useful to remove temporary shared memory objects in the presence
+//!of exceptions
+class remove_shared_memory_on_destroy
+{
+ const char * m_name;
+ public:
+ remove_shared_memory_on_destroy(const char *name)
+ : m_name(name)
+ {}
+
+ ~remove_shared_memory_on_destroy()
+ { shared_memory_object::remove(m_name); }
+};
+
} //namespace interprocess {
} //namespace boost {
Modified: trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/shared_count.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -73,6 +73,11 @@
{}
template <class Ptr>
+ shared_count(const shared_count &other_shared_count, const Ptr &p)
+ : m_px(p), m_pi(other_shared_count.m_pi)
+ {}
+
+ template <class Ptr>
shared_count(const Ptr &p, const VoidAllocator &a, Deleter d)
: m_px(p), m_pi(0)
{
Modified: trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/enable_shared_from_this.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -60,7 +60,6 @@
return p;
}
- private:
/// @cond
typedef T element_type;
mutable weak_ptr<element_type, A, D> _internal_weak_this;
Modified: trunk/boost/interprocess/smart_ptr/shared_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/shared_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/shared_ptr.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -24,6 +24,7 @@
#include <boost/assert.hpp>
#include <boost/interprocess/smart_ptr/detail/shared_count.hpp>
#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/interprocess/detail/move.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/smart_ptr/deleter.hpp>
@@ -47,19 +48,21 @@
template<class T, class VoidAllocator, class Deleter>
inline void sp_enable_shared_from_this
- (shared_count<T, VoidAllocator, Deleter> const & pn,
- const typename pointer_to_other <typename shared_count<T, VoidAllocator, Deleter>::pointer,
- enable_shared_from_this<T, VoidAllocator, Deleter> >::type &pe,
- const typename shared_count<T, VoidAllocator, Deleter>::pointer &px)
+ (shared_count<T, VoidAllocator, Deleter> const & pn
+ ,enable_shared_from_this<T, VoidAllocator, Deleter> *pe
+ ,T *ptr)
+
{
- if(pe != 0)
+ (void)ptr;
+ if(pe != 0){
pe->_internal_weak_this._internal_assign(pn);
+ }
}
-/*
+
template<class T, class VoidAllocator, class Deleter>
inline void sp_enable_shared_from_this(shared_count<T, VoidAllocator, Deleter> const &, ...)
{}
-*/
+
} // namespace detail
//!shared_ptr stores a pointer to a dynamically allocated object.
@@ -122,9 +125,17 @@
typedef typename detail::pointer_to_other<pointer, T>::type ParameterPointer;
BOOST_STATIC_ASSERT((detail::is_same<pointer, ParameterPointer>::value) ||
(detail::is_pointer<pointer>::value));
- //detail::sp_enable_shared_from_this( m_pn, p, p );
+ detail::sp_enable_shared_from_this<T, VoidAllocator, Deleter>( m_pn, detail::get_pointer(p), detail::get_pointer(p) );
}
+
+ //!Constructs a shared_ptr that shares ownership with r and stores p.
+ //!Postconditions: get() == p && use_count() == r.use_count().
+ //!Throws: nothing.
+ shared_ptr(const shared_ptr &other, const pointer &p)
+ : m_pn(other.m_pn, p)
+ {}
+
//!If r is empty, constructs an empty shared_ptr. Otherwise, constructs
//!a shared_ptr that shares ownership with r. Never throws.
template<class Y>
@@ -139,6 +150,19 @@
: m_pn(r.m_pn) // may throw
{}
+ //!Move-Constructs a shared_ptr that takes ownership of other resource and
+ //!other is put in default-constructed state.
+ //!Throws: nothing.
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
+ explicit shared_ptr(detail::moved_object<shared_ptr> other)
+ : m_pn()
+ { this->swap(other.get()); }
+ #else
+ explicit shared_ptr(shared_ptr &&other)
+ : m_pn()
+ { this->swap(other); }
+ #endif
+
/// @cond
template<class Y>
shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, detail::static_cast_tag)
@@ -172,6 +196,22 @@
return *this;
}
+ //!Move-assignment. Equivalent to shared_ptr(other).swap(*this).
+ //!Never throws
+ #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
+ shared_ptr & operator=(detail::moved_object<shared_ptr> other) // never throws
+ {
+ this_type(other).swap(*this);
+ return *this;
+ }
+ #else
+ shared_ptr & operator=(shared_ptr &&other) // never throws
+ {
+ this_type(other).swap(*this);
+ return *this;
+ }
+ #endif
+
//!This is equivalent to:
//!this_type().swap(*this);
void reset()
@@ -192,6 +232,12 @@
this_type(p, a, d).swap(*this);
}
+ template<class Y>
+ void reset(shared_ptr<Y, VoidAllocator, Deleter> const & r, const pointer &p)
+ {
+ this_type(r, p).swap(*this);
+ }
+
//!Returns a reference to the
//!pointed type
reference operator* () const // never throws
@@ -333,6 +379,18 @@
get_deleter(shared_ptr<T, VoidAllocator, Deleter> const & p)
{ return static_cast<Deleter *>(p._internal_get_deleter(typeid(Deleter))); }
*/
+
+/// @cond
+
+//!This class has move constructor
+template <class T, class VA, class D>
+struct is_movable<boost::interprocess::shared_ptr<T, VA, D> >
+{
+ enum { value = true };
+};
+
+/// @endcond
+
} // namespace interprocess
/// @cond
Modified: trunk/boost/interprocess/smart_ptr/unique_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/unique_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/unique_ptr.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -142,7 +142,7 @@
//!
//!After the construction, u no longer owns a pointer.
//![ Note: The deleter constructor can be implemented with
- //!std::forward<D>. -end note ]
+ //!std::detail::forward_impl<D>. -end note ]
//!
//!Postconditions: get() == value u.get() had before the construction.
//!get_deleter() returns a reference to the internally stored deleter which
@@ -152,11 +152,11 @@
//!Throws: nothing.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
unique_ptr(detail::moved_object<unique_ptr> u)
- : ptr_(u.get().release(), move(u.get().get_deleter()))
+ : ptr_(u.get().release(), detail::move_impl(u.get().get_deleter()))
{}
#else
unique_ptr(unique_ptr &&u)
- : ptr_(u.release(), forward<D>(u.get_deleter()))
+ : ptr_(u.release(), detail::forward_impl<D>(u.get_deleter()))
{}
#endif
@@ -192,12 +192,12 @@
,
nat
>::type = nat())
- : ptr_(const_cast<unique_ptr<U,E>&>(u.get()).release(), move(u.get().get_deleter()))
+ : ptr_(const_cast<unique_ptr<U,E>&>(u.get()).release(), detail::move_impl(u.get().get_deleter()))
{}
#else
template <class U, class E>
unique_ptr(unique_ptr<U, E> && u,
- typename boost::enable_if_c<
+ typename detail::enable_if_c<
detail::is_convertible<typename unique_ptr<U, E>::pointer, pointer>::value &&
detail::is_convertible<E, D>::value &&
(
@@ -207,7 +207,7 @@
,
nat
>::type = nat())
- : ptr_(const_cast<unique_ptr<U,E>&>(u).release(), forward<D>(u.get_deleter()))
+ : ptr_(const_cast<unique_ptr<U,E>&>(u).release(), detail::forward_impl<D>(u.get_deleter()))
{}
#endif
@@ -234,14 +234,14 @@
unique_ptr& operator=(detail::moved_object<unique_ptr> u)
{
reset(u.get().release());
- ptr_.second() = move(u.get().get_deleter());
+ ptr_.second() = detail::move_impl(u.get().get_deleter());
return *this;
}
#else
- unique_ptr(unique_ptr && u)
+ unique_ptr& operator=(unique_ptr && u)
{
reset(u.release());
- ptr_.second() = move(u.get_deleter());
+ ptr_.second() = detail::move_impl(u.get_deleter());
return *this;
}
#endif
@@ -265,14 +265,14 @@
unique_ptr& operator=(detail::moved_object<unique_ptr<U, E> > mu)
{
reset(mu.get().release());
- ptr_.second() = move(mu.get().get_deleter());
+ ptr_.second() = detail::move_impl(mu.get().get_deleter());
return *this;
}
#else
- unique_ptr(unique_ptr<U, E> && u)
+ unique_ptr& operator=(unique_ptr<U, E> && u)
{
reset(u.release());
- ptr_.second() = move(u.get_deleter());
+ ptr_.second() = detail::move_impl(u.get_deleter());
return *this;
}
#endif
@@ -597,9 +597,13 @@
//!with boost::interproces::deleter from a pointer
//!of type T that has been allocated in the passed managed segment
template<class T, class ManagedMemory>
+#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
inline typename detail::return_type
<typename managed_unique_ptr<T, ManagedMemory>::type
>::type
+#else
+typename managed_unique_ptr<T, ManagedMemory>::type
+#endif
make_managed_unique_ptr(T *constructed_object, ManagedMemory &managed_memory)
{
typename managed_unique_ptr<T, ManagedMemory>::type to_return
Modified: trunk/boost/interprocess/smart_ptr/weak_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/weak_ptr.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/weak_ptr.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -200,7 +200,10 @@
template<class Y>
void _internal_assign(const detail::shared_count<Y, A, D> & pn2)
- { m_pn = pn2; }
+ {
+
+ m_pn = pn2;
+ }
private:
Modified: trunk/boost/interprocess/sync/emulation/interprocess_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/emulation/interprocess_condition.hpp (original)
+++ trunk/boost/interprocess/sync/emulation/interprocess_condition.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -9,7 +9,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
-
+#include <boost/interprocess/detail/move.hpp>
namespace boost {
namespace interprocess {
@@ -94,11 +94,11 @@
InternalLock lock;
if(tout_enabled){
InternalLock dummy(m_enter_mut, abs_time);
- lock = move(dummy);
+ lock = detail::move_impl(dummy);
}
else{
InternalLock dummy(m_enter_mut);
- lock = move(dummy);
+ lock = detail::move_impl(dummy);
}
if(!lock)
@@ -161,11 +161,11 @@
InternalLock lock;
if(tout_enabled){
InternalLock dummy(m_check_mut, abs_time);
- lock = move(dummy);
+ lock = detail::move_impl(dummy);
}
else{
InternalLock dummy(m_check_mut);
- lock = move(dummy);
+ lock = detail::move_impl(dummy);
}
if(!lock)
Added: trunk/boost/interprocess/sync/math_functions.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/sync/math_functions.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -0,0 +1,110 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Stephen Cleary 2000.
+// (C) Copyright Ion Gaztanaga 2007-2008.
+//
+// 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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+// This file is a slightly modified file from Boost.Pool
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
+#define BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
+
+#include <boost/static_assert.hpp> //BOOST_STATIC_ASSERT
+#include <climits> //CHAR_BIT
+
+namespace boost {
+namespace interprocess {
+namespace detail {
+
+// Greatest common divisor and least common multiple
+
+//
+// gcd is an algorithm that calculates the greatest common divisor of two
+// integers, using Euclid's algorithm.
+//
+// Pre: A > 0 && B > 0
+// Recommended: A > B
+template <typename Integer>
+inline Integer gcd(Integer A, Integer B)
+{
+ do
+ {
+ const Integer tmp(B);
+ B = A % B;
+ A = tmp;
+ } while (B != 0);
+
+ return A;
+}
+
+//
+// lcm is an algorithm that calculates the least common multiple of two
+// integers.
+//
+// Pre: A > 0 && B > 0
+// Recommended: A > B
+template <typename Integer>
+inline Integer lcm(const Integer & A, const Integer & B)
+{
+ Integer ret = A;
+ ret /= gcd(A, B);
+ ret *= B;
+ return ret;
+}
+
+template <typename Integer>
+inline Integer log2_ceil(const Integer & A)
+{
+ Integer i = 0;
+ Integer power_of_2 = 1;
+
+ while(power_of_2 < A){
+ power_of_2 <<= 1;
+ ++i;
+ }
+ return i;
+}
+
+template <typename Integer>
+inline Integer upper_power_of_2(const Integer & A)
+{
+ Integer power_of_2 = 1;
+
+ while(power_of_2 < A){
+ power_of_2 <<= 1;
+ }
+ return power_of_2;
+}
+
+//This function uses binary search to discover the
+//highest set bit of the integer
+inline std::size_t floor_log2 (std::size_t x)
+{
+ const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
+ const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
+ BOOST_STATIC_ASSERT(Size_t_Bits_Power_2);
+
+ std::size_t n = x;
+ std::size_t log2 = 0;
+
+ for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
+ std::size_t tmp = n >> shift;
+ if (tmp)
+ log2 += shift, n = tmp;
+ }
+
+ return log2;
+}
+
+} // namespace detail
+} // namespace interprocess
+} // namespace boost
+
+#endif
Modified: trunk/boost/interprocess/sync/scoped_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/scoped_lock.hpp (original)
+++ trunk/boost/interprocess/sync/scoped_lock.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -122,15 +122,16 @@
//! to thisscoped_lock with no blocking. If the scop scoped_lock does not
//! own the mutex, then neither will this scoped_lock. Only a moved
//! scoped_lock's will match this signature. An non-moved scoped_lock
- //! can be moved with the expression: "move(lock);". This
+ //! can be moved with the expression: "detail::move_impl(lock);". This
//! constructor does not alter the state of the mutex, only potentially
//! who owns it.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit scoped_lock(detail::moved_object<scoped_lock<Mutex> > scop)
+ scoped_lock(detail::moved_object<scoped_lock<Mutex> > scop)
: mp_mutex(0), m_locked(scop.get().owns())
{ mp_mutex = scop.get().release(); }
#else
- explicit scoped_lock(scoped_lock<Mutex> &&scop)
+
+ scoped_lock(scoped_lock &&scop)
: mp_mutex(0), m_locked(scop.owns())
{ mp_mutex = scop.release(); }
#endif
@@ -144,11 +145,11 @@
//! unlocking upgr. If upgr is unlocked, then this scoped_lock will be
//! unlocked as well. Only a moved upgradable_lock's will match this
//! signature. An non-moved upgradable_lock can be moved with
- //! the expression: "move(lock);" This constructor may block if
+ //! the expression: "detail::move_impl(lock);" This constructor may block if
//! other threads hold a sharable_lock on this mutex (sharable_lock's can
//! share ownership with an upgradable_lock).
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit scoped_lock(detail::moved_object<upgradable_lock<Mutex> > upgr)
+ scoped_lock(detail::moved_object<upgradable_lock<Mutex> > upgr)
: mp_mutex(0), m_locked(false)
{
upgradable_lock<mutex_type> &u_lock = upgr.get();
@@ -159,7 +160,7 @@
mp_mutex = u_lock.release();
}
#else
- explicit scoped_lock(upgradable_lock<Mutex> &&upgr)
+ scoped_lock(upgradable_lock<Mutex> &&upgr)
: mp_mutex(0), m_locked(false)
{
upgradable_lock<mutex_type> &u_lock = upgr;
@@ -326,7 +327,7 @@
//! mutex after the assignment (and scop will not), but the mutex's lock
//! count will be decremented by one.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- scoped_lock &operator=(detail::moved_object<scoped_lock<Mutex> > scop)
+ scoped_lock &operator=(detail::moved_object<scoped_lock> scop)
{
if(this->owns())
this->unlock();
@@ -335,7 +336,7 @@
return *this;
}
#else
- scoped_lock &operator=(scoped_lock<Mutex> &&scop)
+ scoped_lock &operator=(scoped_lock &&scop)
{
if(this->owns())
this->unlock();
Modified: trunk/boost/interprocess/sync/sharable_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/sharable_lock.hpp (original)
+++ trunk/boost/interprocess/sync/sharable_lock.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -127,14 +127,14 @@
//! sharable_lock with no blocking. If the upgr sharable_lock does not own the mutex, then
//! neither will this sharable_lock. Only a moved sharable_lock's will match this
//! signature. An non-moved sharable_lock can be moved with the expression:
- //! "move(lock);". This constructor does not alter the state of the mutex,
+ //! "detail::move_impl(lock);". This constructor does not alter the state of the mutex,
//! only potentially who owns it.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit sharable_lock(detail::moved_object<sharable_lock<mutex_type> > upgr)
+ sharable_lock(detail::moved_object<sharable_lock<mutex_type> > upgr)
: mp_mutex(0), m_locked(upgr.get().owns())
{ mp_mutex = upgr.get().release(); }
#else
- explicit sharable_lock(sharable_lock<mutex_type> &&upgr)
+ sharable_lock(sharable_lock<mutex_type> &&upgr)
: mp_mutex(0), m_locked(upgr.owns())
{ mp_mutex = upgr.release(); }
#endif
@@ -147,9 +147,9 @@
//!Notes: If upgr is locked, this constructor will lock this sharable_lock while
//! unlocking upgr. Only a moved sharable_lock's will match this
//! signature. An non-moved upgradable_lock can be moved with the expression:
- //! "move(lock);".*/
+ //! "detail::move_impl(lock);".*/
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit sharable_lock(detail::moved_object<upgradable_lock<mutex_type> > upgr)
+ sharable_lock(detail::moved_object<upgradable_lock<mutex_type> > upgr)
: mp_mutex(0), m_locked(false)
{
upgradable_lock<mutex_type> &u_lock = upgr.get();
@@ -160,7 +160,7 @@
mp_mutex = u_lock.release();
}
#else
- explicit sharable_lock(upgradable_lock<mutex_type> &&upgr)
+ sharable_lock(upgradable_lock<mutex_type> &&upgr)
: mp_mutex(0), m_locked(false)
{
upgradable_lock<mutex_type> &u_lock = upgr;
@@ -181,9 +181,9 @@
//! to a sharable-ownership of this sharable_lock.
//! Only a moved scoped_lock's will match this
//! signature. An non-moved scoped_lock can be moved with the expression:
- //! "move(lock);".*/
+ //! "detail::move_impl(lock);".*/
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit sharable_lock(detail::moved_object<scoped_lock<mutex_type> > scop)
+ sharable_lock(detail::moved_object<scoped_lock<mutex_type> > scop)
: mp_mutex(0), m_locked(false)
{
scoped_lock<mutex_type> &e_lock = scop.get();
@@ -194,7 +194,7 @@
mp_mutex = e_lock.release();
}
#else
- explicit sharable_lock(scoped_lock<mutex_type> &&scop)
+ sharable_lock(scoped_lock<mutex_type> &&scop)
: mp_mutex(0), m_locked(false)
{
scoped_lock<mutex_type> &e_lock = scop;
Modified: trunk/boost/interprocess/sync/upgradable_lock.hpp
==============================================================================
--- trunk/boost/interprocess/sync/upgradable_lock.hpp (original)
+++ trunk/boost/interprocess/sync/upgradable_lock.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -121,14 +121,14 @@
//! while unlocking upgr. If upgr is unlocked, then this upgradable_lock will
//! be unlocked as well. Only a moved upgradable_lock's will match this
//! signature. An non-moved upgradable_lock can be moved with the
- //! expression: "move(lock);". This constructor does not alter the
+ //! expression: "detail::move_impl(lock);". This constructor does not alter the
//! state of the mutex, only potentially who owns it.
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit upgradable_lock(detail::moved_object<upgradable_lock<mutex_type> > upgr)
+ upgradable_lock(detail::moved_object<upgradable_lock<mutex_type> > upgr)
: mp_mutex(0), m_locked(upgr.get().owns())
{ mp_mutex = upgr.get().release(); }
#else
- explicit upgradable_lock(upgradable_lock<mutex_type> &&upgr)
+ upgradable_lock(upgradable_lock<mutex_type> &&upgr)
: mp_mutex(0), m_locked(upgr.owns())
{ mp_mutex = upgr.release(); }
#endif
@@ -141,9 +141,9 @@
//! to an upgradable-ownership of this upgradable_lock.
//! Only a moved sharable_lock's will match this
//! signature. An non-moved sharable_lock can be moved with the
- //! expression: "move(lock);".
+ //! expression: "detail::move_impl(lock);".
#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE
- explicit upgradable_lock(detail::moved_object<scoped_lock<mutex_type> > scop)
+ upgradable_lock(detail::moved_object<scoped_lock<mutex_type> > scop)
: mp_mutex(0), m_locked(false)
{
scoped_lock<mutex_type> &u_lock = scop.get();
@@ -154,7 +154,7 @@
mp_mutex = u_lock.release();
}
#else
- explicit upgradable_lock(scoped_lock<mutex_type> &&scop)
+ upgradable_lock(scoped_lock<mutex_type> &&scop)
: mp_mutex(0), m_locked(false)
{
scoped_lock<mutex_type> &u_lock = scop;
Modified: trunk/boost/interprocess/windows_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/windows_shared_memory.hpp (original)
+++ trunk/boost/interprocess/windows_shared_memory.hpp 2008-06-21 05:05:10 EDT (Sat, 21 Jun 2008)
@@ -104,7 +104,7 @@
#else
windows_shared_memory &operator=(windows_shared_memory &&moved)
{
- windows_shared_memory tmp(move(moved));
+ windows_shared_memory tmp(detail::move_impl(moved));
this->swap(tmp);
return *this;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk