mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
gcc 4.3 fixes for normal and -std=c++0x modes
[SVN r46576]
This commit is contained in:
@@ -32,6 +32,8 @@ typedef detail::adaptive_pool_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class adaptive_pool<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::adaptive_pool_v1<int, managed_shared_memory::segment_manager>;
|
||||
template class adaptive_pool<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::adaptive_pool_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, shmem_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -34,7 +34,8 @@ typedef detail::cached_adaptive_pool_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class cached_adaptive_pool<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::cached_adaptive_pool_v1<int, managed_shared_memory::segment_manager>;
|
||||
|
||||
template class cached_adaptive_pool<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::cached_adaptive_pool_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, cached_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -32,6 +32,8 @@ typedef detail::cached_node_allocator_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class cached_node_allocator<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::cached_node_allocator_v1<int, managed_shared_memory::segment_manager>;
|
||||
template class cached_node_allocator<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::cached_node_allocator_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, cached_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -65,12 +65,12 @@ bool copyable_only(V1 *shmdeque, V2 *stddeque, detail::true_type)
|
||||
{
|
||||
IntType move_me(1);
|
||||
stddeque->insert(stddeque->begin()+size/2, 50, 1);
|
||||
shmdeque->insert(shmdeque->begin()+size/2, 50, move(move_me));
|
||||
shmdeque->insert(shmdeque->begin()+size/2, 50, detail::move_impl(move_me));
|
||||
if(!test::CheckEqualContainers(shmdeque, stddeque)) return false;
|
||||
}
|
||||
{
|
||||
IntType move_me(2);
|
||||
shmdeque->assign(shmdeque->size()/2, move(move_me));
|
||||
shmdeque->assign(shmdeque->size()/2, detail::move_impl(move_me));
|
||||
stddeque->assign(stddeque->size()/2, 2);
|
||||
if(!test::CheckEqualContainers(shmdeque, stddeque)) return false;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ bool do_test()
|
||||
int i;
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmdeque->insert(shmdeque->end(), move(move_me));
|
||||
shmdeque->insert(shmdeque->end(), detail::move_impl(move_me));
|
||||
stddeque->insert(stddeque->end(), i);
|
||||
}
|
||||
if(!test::CheckEqualContainers(shmdeque, stddeque)) return 1;
|
||||
@@ -141,7 +141,7 @@ bool do_test()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me (-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -164,7 +164,7 @@ bool do_test()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -189,7 +189,7 @@ bool do_test()
|
||||
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmdeque->insert(shmdeque->begin(), move(move_me));
|
||||
shmdeque->insert(shmdeque->begin(), detail::move_impl(move_me));
|
||||
stddeque->insert(stddeque->begin(), i);
|
||||
}
|
||||
if(!test::CheckEqualContainers(shmdeque, stddeque)) return 1;
|
||||
|
||||
@@ -115,7 +115,7 @@ class dummy_test_allocator
|
||||
size_type,
|
||||
size_type,
|
||||
size_type &, const pointer & = 0)
|
||||
{ return std::pair<pointer, bool>(0, true); }
|
||||
{ return std::pair<pointer, bool>(pointer(0), true); }
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold.
|
||||
|
||||
@@ -125,9 +125,9 @@ int main ()
|
||||
{
|
||||
//Now test move semantics
|
||||
file_mapping mapping(test::get_process_id_name(), read_only);
|
||||
file_mapping move_ctor(move(mapping));
|
||||
file_mapping move_ctor(detail::move_impl(mapping));
|
||||
file_mapping move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
catch(std::exception &exc){
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/indexes/iset_index.hpp>
|
||||
#include "named_allocation_test_template.hpp"
|
||||
|
||||
@@ -36,7 +36,7 @@ struct push_data_function
|
||||
typedef typename MyShmList::value_type IntType;
|
||||
for(int i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmlist->push_back(move(move_me));
|
||||
shmlist->push_back(detail::move_impl(move_me));
|
||||
stdlist->push_back(i);
|
||||
}
|
||||
if(!CheckEqualContainers(shmlist, stdlist))
|
||||
@@ -54,7 +54,7 @@ struct push_data_function<false>
|
||||
typedef typename MyShmList::value_type IntType;
|
||||
for(int i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmlist->push_front(move(move_me));
|
||||
shmlist->push_front(detail::move_impl(move_me));
|
||||
stdlist->push_front(i);
|
||||
}
|
||||
if(!CheckEqualContainers(shmlist, stdlist))
|
||||
@@ -136,7 +136,7 @@ int list_test (bool copied_allocators_equal = true)
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -166,7 +166,7 @@ int list_test (bool copied_allocators_equal = true)
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
|
||||
@@ -117,6 +117,15 @@ int main ()
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
{
|
||||
//Map preexisting file again in copy-on-write
|
||||
managed_mapped_file mfile(open_read_only, FileName);
|
||||
|
||||
//Check vector is still there
|
||||
MyVect *mfile_vect = mfile.find<MyVect>("MyVector").first;
|
||||
if(!mfile_vect)
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
std::size_t old_free_memory;
|
||||
{
|
||||
@@ -194,9 +203,9 @@ int main ()
|
||||
{
|
||||
//Now test move semantics
|
||||
managed_mapped_file original(open_only, FileName);
|
||||
managed_mapped_file move_ctor(move(original));
|
||||
managed_mapped_file move_ctor(detail::move_impl(original));
|
||||
managed_mapped_file move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,15 @@ int main ()
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
{
|
||||
//Map preexisting shmem again in copy-on-write
|
||||
managed_shared_memory shmem(open_read_only, ShmemName);
|
||||
|
||||
//Check vector is still there
|
||||
MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
|
||||
if(!shmem_vect)
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
std::size_t old_free_memory;
|
||||
{
|
||||
@@ -190,9 +199,9 @@ int main ()
|
||||
{
|
||||
//Now test move semantics
|
||||
managed_shared_memory original(open_only, ShmemName);
|
||||
managed_shared_memory move_ctor(move(original));
|
||||
managed_shared_memory move_ctor(detail::move_impl(original));
|
||||
managed_shared_memory move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,15 @@ int main ()
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
{
|
||||
//Map preexisting shmem again in copy-on-write
|
||||
managed_windows_shared_memory shmem(open_read_only, MemName);
|
||||
|
||||
//Check vector is still there
|
||||
MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
|
||||
if(!shmem_vect)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Destroy and check it is not present
|
||||
w_shm_new.destroy_ptr(w_shm_vect);
|
||||
@@ -121,9 +130,9 @@ int main ()
|
||||
|
||||
//Now test move semantics
|
||||
managed_windows_shared_memory original(open_only, MemName);
|
||||
managed_windows_shared_memory move_ctor(move(original));
|
||||
managed_windows_shared_memory move_ctor(detail::move_impl(original));
|
||||
managed_windows_shared_memory move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,9 +115,9 @@ int map_test ()
|
||||
|
||||
int i, j;
|
||||
for(i = 0; i < max; ++i){
|
||||
shmmap->insert(move(IntPairType (move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(detail::move_impl(IntPairType (detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(StdPairType(i, i));
|
||||
shmmultimap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(StdPairType(i, i));
|
||||
}
|
||||
|
||||
@@ -232,9 +232,9 @@ int map_test ()
|
||||
}
|
||||
|
||||
for(i = 0; i < max; ++i){
|
||||
shmmap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(StdPairType(i, i));
|
||||
shmmultimap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(StdPairType(i, i));
|
||||
}
|
||||
|
||||
@@ -242,10 +242,10 @@ int map_test ()
|
||||
if(!CheckEqualPairContainers(shmmultimap, stdmultimap)) return 1;
|
||||
|
||||
for(i = 0; i < max; ++i){
|
||||
shmmap->insert(shmmap->begin(), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(shmmap->begin(), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(stdmap->begin(), StdPairType(i, i));
|
||||
//PrintContainers(shmmap, stdmap);
|
||||
shmmultimap->insert(shmmultimap->begin(), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(shmmultimap->begin(), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(stdmultimap->begin(), StdPairType(i, i));
|
||||
//PrintContainers(shmmultimap, stdmultimap);
|
||||
if(!CheckEqualPairContainers(shmmap, stdmap))
|
||||
@@ -253,29 +253,29 @@ int map_test ()
|
||||
if(!CheckEqualPairContainers(shmmultimap, stdmultimap))
|
||||
return 1;
|
||||
|
||||
shmmap->insert(shmmap->end(), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(shmmap->end(), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(stdmap->end(), StdPairType(i, i));
|
||||
shmmultimap->insert(shmmultimap->end(), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(shmmultimap->end(), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(stdmultimap->end(), StdPairType(i, i));
|
||||
if(!CheckEqualPairContainers(shmmap, stdmap))
|
||||
return 1;
|
||||
if(!CheckEqualPairContainers(shmmultimap, stdmultimap))
|
||||
return 1;
|
||||
|
||||
shmmap->insert(shmmap->lower_bound(IntType(i)), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(shmmap->lower_bound(IntType(i)), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(stdmap->lower_bound(i), StdPairType(i, i));
|
||||
//PrintContainers(shmmap, stdmap);
|
||||
shmmultimap->insert(shmmultimap->lower_bound(IntType(i)), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(shmmultimap->lower_bound(IntType(i)), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(stdmultimap->lower_bound(i), StdPairType(i, i));
|
||||
//PrintContainers(shmmultimap, stdmultimap);
|
||||
if(!CheckEqualPairContainers(shmmap, stdmap))
|
||||
return 1;
|
||||
if(!CheckEqualPairContainers(shmmultimap, stdmultimap))
|
||||
return 1;
|
||||
shmmap->insert(shmmap->upper_bound(IntType(i)), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(shmmap->upper_bound(IntType(i)), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(stdmap->upper_bound(i), StdPairType(i, i));
|
||||
//PrintContainers(shmmap, stdmap);
|
||||
shmmultimap->insert(shmmultimap->upper_bound(IntType(i)), move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(shmmultimap->upper_bound(IntType(i)), detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(stdmultimap->upper_bound(i), StdPairType(i, i));
|
||||
//PrintContainers(shmmultimap, stdmultimap);
|
||||
if(!CheckEqualPairContainers(shmmap, stdmap))
|
||||
@@ -303,8 +303,8 @@ int map_test ()
|
||||
|
||||
for(j = 0; j < 3; ++j)
|
||||
for(i = 0; i < 100; ++i){
|
||||
shmmap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
shmmultimap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
if(shmmap->count(IntType(i)) != typename MyShmMultiMap::size_type(1))
|
||||
return 1;
|
||||
if(shmmultimap->count(IntType(i)) != typename MyShmMultiMap::size_type(j+1))
|
||||
@@ -367,9 +367,9 @@ int map_test_copyable ()
|
||||
|
||||
int i;
|
||||
for(i = 0; i < max; ++i){
|
||||
shmmap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmap->insert(StdPairType(i, i));
|
||||
shmmultimap->insert(move(IntPairType(move(IntType(i)), move(IntType(i)))));
|
||||
shmmultimap->insert(detail::move_impl(IntPairType(detail::move_impl(IntType(i)), detail::move_impl(IntType(i)))));
|
||||
stdmultimap->insert(StdPairType(i, i));
|
||||
}
|
||||
if(!CheckEqualContainers(shmmap, stdmap)) return 1;
|
||||
|
||||
@@ -76,9 +76,9 @@ int main ()
|
||||
std::memset(file1.get_user_address(), 0, file1.get_user_size());
|
||||
|
||||
//Now test move semantics
|
||||
mapped_file move_ctor(move(file1));
|
||||
mapped_file move_ctor(detail::move_impl(file1));
|
||||
mapped_file move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
std::remove(FileName);
|
||||
return 0;
|
||||
|
||||
@@ -31,6 +31,8 @@ typedef detail::node_allocator_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class node_allocator<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::node_allocator_v1<int, managed_shared_memory::segment_manager>;
|
||||
template class node_allocator<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::node_allocator_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, shmem_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -31,6 +31,8 @@ typedef detail::private_adaptive_pool_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class private_adaptive_pool<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::private_adaptive_pool_v1<int, managed_shared_memory::segment_manager>;
|
||||
template class private_adaptive_pool<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::private_adaptive_pool_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, priv_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -31,6 +31,8 @@ typedef detail::private_node_allocator_v1
|
||||
//Explicit instantiations to catch compilation errors
|
||||
template class private_node_allocator<int, managed_shared_memory::segment_manager>;
|
||||
template class detail::private_node_allocator_v1<int, managed_shared_memory::segment_manager>;
|
||||
template class private_node_allocator<void, managed_shared_memory::segment_manager>;
|
||||
template class detail::private_node_allocator_v1<void, managed_shared_memory::segment_manager>;
|
||||
|
||||
//Alias list types
|
||||
typedef list<int, priv_node_allocator_t> MyShmList;
|
||||
|
||||
@@ -63,7 +63,7 @@ int set_test ()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -72,7 +72,7 @@ int set_test ()
|
||||
IntType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(i/2);
|
||||
aux_vect3[i] = move(move_me);
|
||||
aux_vect3[i] = detail::move_impl(move_me);
|
||||
}
|
||||
|
||||
MyShmSet *shmset2 =
|
||||
@@ -108,20 +108,20 @@ int set_test ()
|
||||
int i, j;
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmset->insert(move(move_me));
|
||||
shmset->insert(detail::move_impl(move_me));
|
||||
stdset->insert(i);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(move(move_me2));
|
||||
shmmultiset->insert(detail::move_impl(move_me2));
|
||||
stdmultiset->insert(i);
|
||||
}
|
||||
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(move(move_me)" << std::endl;
|
||||
std::cout << "Error in shmset->insert(detail::move_impl(move_me)" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(move(move_me)" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(detail::move_impl(move_me)" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ int set_test ()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -192,7 +192,7 @@ int set_test ()
|
||||
IntType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect3[i] = move(move_me);
|
||||
aux_vect3[i] = detail::move_impl(move_me);
|
||||
}
|
||||
|
||||
shmset->insert(detail::make_move_iterator(&aux_vect[0]), detail::make_move_iterator(aux_vect + 50));
|
||||
@@ -228,7 +228,7 @@ int set_test ()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect[i] = move(move_me);
|
||||
aux_vect[i] = detail::move_impl(move_me);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -237,19 +237,19 @@ int set_test ()
|
||||
IntType aux_vect3[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect3[i] = move(move_me);
|
||||
aux_vect3[i] = detail::move_impl(move_me);
|
||||
}
|
||||
|
||||
IntType aux_vect4[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect4[i] = move(move_me);
|
||||
aux_vect4[i] = detail::move_impl(move_me);
|
||||
}
|
||||
|
||||
IntType aux_vect5[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType move_me(-1);
|
||||
aux_vect5[i] = move(move_me);
|
||||
aux_vect5[i] = detail::move_impl(move_me);
|
||||
}
|
||||
|
||||
shmset->insert(detail::make_move_iterator(&aux_vect[0]), detail::make_move_iterator(aux_vect + 50));
|
||||
@@ -285,88 +285,88 @@ int set_test ()
|
||||
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmset->insert(move(move_me));
|
||||
shmset->insert(detail::move_impl(move_me));
|
||||
stdset->insert(i);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(move(move_me2));
|
||||
shmmultiset->insert(detail::move_impl(move_me2));
|
||||
stdmultiset->insert(i);
|
||||
}
|
||||
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(move(move_me)) try 2" << std::endl;
|
||||
std::cout << "Error in shmset->insert(detail::move_impl(move_me)) try 2" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(move(move_me2)) try 2" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(detail::move_impl(move_me2)) try 2" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmset->insert(shmset->begin(), move(move_me));
|
||||
shmset->insert(shmset->begin(), detail::move_impl(move_me));
|
||||
stdset->insert(stdset->begin(), i);
|
||||
//PrintContainers(shmset, stdset);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(shmmultiset->begin(), move(move_me2));
|
||||
shmmultiset->insert(shmmultiset->begin(), detail::move_impl(move_me2));
|
||||
stdmultiset->insert(stdmultiset->begin(), i);
|
||||
//PrintContainers(shmmultiset, stdmultiset);
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(shmset->begin(), move(move_me))" << std::endl;
|
||||
std::cout << "Error in shmset->insert(shmset->begin(), detail::move_impl(move_me))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->begin(), move(move_me2))" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->begin(), detail::move_impl(move_me2))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
IntType move_me3(i);
|
||||
shmset->insert(shmset->end(), move(move_me3));
|
||||
shmset->insert(shmset->end(), detail::move_impl(move_me3));
|
||||
stdset->insert(stdset->end(), i);
|
||||
IntType move_me4(i);
|
||||
shmmultiset->insert(shmmultiset->end(), move(move_me4));
|
||||
shmmultiset->insert(shmmultiset->end(), detail::move_impl(move_me4));
|
||||
stdmultiset->insert(stdmultiset->end(), i);
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(shmset->end(), move(move_me3))" << std::endl;
|
||||
std::cout << "Error in shmset->insert(shmset->end(), detail::move_impl(move_me3))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->end(), move(move_me4))" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->end(), detail::move_impl(move_me4))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
IntType move_me(i);
|
||||
shmset->insert(shmset->upper_bound(move_me), move(move_me));
|
||||
shmset->insert(shmset->upper_bound(move_me), detail::move_impl(move_me));
|
||||
stdset->insert(stdset->upper_bound(i), i);
|
||||
//PrintContainers(shmset, stdset);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(shmmultiset->upper_bound(move_me2), move(move_me2));
|
||||
shmmultiset->insert(shmmultiset->upper_bound(move_me2), detail::move_impl(move_me2));
|
||||
stdmultiset->insert(stdmultiset->upper_bound(i), i);
|
||||
//PrintContainers(shmmultiset, stdmultiset);
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(shmset->upper_bound(move_me), move(move_me))" << std::endl;
|
||||
std::cout << "Error in shmset->insert(shmset->upper_bound(move_me), detail::move_impl(move_me))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->upper_bound(move_me2), move(move_me2))" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->upper_bound(move_me2), detail::move_impl(move_me2))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
IntType move_me(i);
|
||||
shmset->insert(shmset->lower_bound(move_me), move(move_me2));
|
||||
shmset->insert(shmset->lower_bound(move_me), detail::move_impl(move_me2));
|
||||
stdset->insert(stdset->lower_bound(i), i);
|
||||
//PrintContainers(shmset, stdset);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(shmmultiset->lower_bound(move_me2), move(move_me2));
|
||||
shmmultiset->insert(shmmultiset->lower_bound(move_me2), detail::move_impl(move_me2));
|
||||
stdmultiset->insert(stdmultiset->lower_bound(i), i);
|
||||
//PrintContainers(shmmultiset, stdmultiset);
|
||||
if(!CheckEqualContainers(shmset, stdset)){
|
||||
std::cout << "Error in shmset->insert(shmset->lower_bound(move_me), move(move_me2))" << std::endl;
|
||||
std::cout << "Error in shmset->insert(shmset->lower_bound(move_me), detail::move_impl(move_me2))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if(!CheckEqualContainers(shmmultiset, stdmultiset)){
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->lower_bound(move_me2), move(move_me2))" << std::endl;
|
||||
std::cout << "Error in shmmultiset->insert(shmmultiset->lower_bound(move_me2), detail::move_impl(move_me2))" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -392,9 +392,9 @@ int set_test ()
|
||||
for(j = 0; j < 3; ++j)
|
||||
for(i = 0; i < 100; ++i){
|
||||
IntType move_me(i);
|
||||
shmset->insert(move(move_me));
|
||||
shmset->insert(detail::move_impl(move_me));
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(move(move_me2));
|
||||
shmmultiset->insert(detail::move_impl(move_me2));
|
||||
IntType count_me(i);
|
||||
if(shmset->count(count_me) != typename MyShmMultiSet::size_type(1)){
|
||||
std::cout << "Error in shmset->count(count_me)" << std::endl;
|
||||
@@ -461,10 +461,10 @@ int set_test_copyable ()
|
||||
int i;
|
||||
for(i = 0; i < max; ++i){
|
||||
IntType move_me(i);
|
||||
shmset->insert(move(move_me));
|
||||
shmset->insert(detail::move_impl(move_me));
|
||||
stdset->insert(i);
|
||||
IntType move_me2(i);
|
||||
shmmultiset->insert(move(move_me2));
|
||||
shmmultiset->insert(detail::move_impl(move_me2));
|
||||
stdmultiset->insert(i);
|
||||
}
|
||||
if(!CheckEqualContainers(shmset, stdset)) return 1;
|
||||
|
||||
@@ -139,9 +139,9 @@ int main ()
|
||||
{
|
||||
//Now test move semantics
|
||||
shared_memory_object mapping(open_only, test::get_process_id_name(), read_write);
|
||||
shared_memory_object move_ctor(move(mapping));
|
||||
shared_memory_object move_ctor(detail::move_impl(mapping));
|
||||
shared_memory_object move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
catch(std::exception &exc){
|
||||
|
||||
@@ -76,9 +76,9 @@ int main ()
|
||||
std::memset(shm1.get_user_address(), 0, shm1.get_user_size());
|
||||
|
||||
//Now test move semantics
|
||||
shared_memory move_ctor(move(shm1));
|
||||
shared_memory move_ctor(detail::move_impl(shm1));
|
||||
shared_memory move_assign;
|
||||
move_assign = move(move_ctor);
|
||||
move_assign = detail::move_impl(move_ctor);
|
||||
}
|
||||
}
|
||||
catch(std::exception &ex){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Peter Dimov 2002-2005.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2007.
|
||||
// (C) Copyright Peter Dimov 2002-2005, 2007.
|
||||
// (C) Copyright Ion Gaztanaga 2006-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)
|
||||
@@ -168,6 +168,8 @@ int string_shared_ptr_vector_insertion_test()
|
||||
//Now fill a shared memory vector of shared_ptrs to a string
|
||||
string_shared_ptr_vector_t my_sharedptr_vector(string_shared_ptr_allocator);
|
||||
my_sharedptr_vector.insert(my_sharedptr_vector.begin(), NumElements, string_shared_ptr);
|
||||
//Insert in the middle to test movability
|
||||
my_sharedptr_vector.insert(my_sharedptr_vector.begin() + my_sharedptr_vector.size()/2, NumElements, string_shared_ptr);
|
||||
//Now check the shared count is the objects contained in the
|
||||
//vector plus string_shared_ptr
|
||||
if(string_shared_ptr.use_count() != static_cast<long>(my_sharedptr_vector.size()+1)){
|
||||
@@ -536,6 +538,81 @@ int basic_shared_ptr_test()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
struct alias_tester
|
||||
{
|
||||
int v_;
|
||||
|
||||
explicit alias_tester( int v ): v_( v )
|
||||
{
|
||||
}
|
||||
|
||||
~alias_tester()
|
||||
{
|
||||
v_ = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void test_alias()
|
||||
{
|
||||
typedef allocator<void, managed_shared_memory::segment_manager>
|
||||
v_allocator_t;
|
||||
|
||||
typedef deleter<alias_tester, managed_shared_memory::segment_manager>
|
||||
alias_tester_deleter_t;
|
||||
|
||||
typedef deleter<int, managed_shared_memory::segment_manager>
|
||||
int_deleter_t;
|
||||
|
||||
typedef shared_ptr<alias_tester, v_allocator_t, alias_tester_deleter_t> alias_tester_shared_ptr;
|
||||
|
||||
typedef shared_ptr<int, v_allocator_t, int_deleter_t> int_shared_ptr;
|
||||
typedef shared_ptr<const int, v_allocator_t, int_deleter_t> const_int_shared_ptr;
|
||||
typedef shared_ptr<volatile int, v_allocator_t, int_deleter_t> volatile_int_shared_ptr;
|
||||
|
||||
std::string process_name;
|
||||
test::get_process_id_name(process_name);
|
||||
|
||||
shared_memory_object::remove(process_name.c_str());
|
||||
{
|
||||
managed_shared_memory shmem(create_only, process_name.c_str(), 10000);
|
||||
|
||||
{
|
||||
int m = 0;
|
||||
int_shared_ptr p;
|
||||
int_shared_ptr p2( p, &m );
|
||||
|
||||
BOOST_TEST( detail::get_pointer(p2.get()) == &m );
|
||||
BOOST_TEST( p2? true: false );
|
||||
BOOST_TEST( !!p2 );
|
||||
BOOST_TEST( p2.use_count() == p.use_count() );
|
||||
BOOST_TEST( !( p < p2 ) && !( p2 < p ) );
|
||||
|
||||
p2.reset( p, (int*)0 );
|
||||
|
||||
BOOST_TEST( p2.get() == 0 );
|
||||
|
||||
BOOST_TEST( p2? false: true );
|
||||
BOOST_TEST( !p2 );
|
||||
BOOST_TEST( p2.use_count() == p.use_count() );
|
||||
BOOST_TEST( !( p < p2 ) && !( p2 < p ) );
|
||||
}
|
||||
|
||||
{
|
||||
int m = 0;
|
||||
int_shared_ptr p(make_managed_shared_ptr
|
||||
(shmem.construct<int>(anonymous_instance)(), shmem));
|
||||
const_int_shared_ptr p2( p, &m );
|
||||
|
||||
BOOST_TEST( detail::get_pointer(p2.get()) == &m );
|
||||
BOOST_TEST( p2? true: false );
|
||||
BOOST_TEST( !!p2 );
|
||||
BOOST_TEST( p2.use_count() == p.use_count() );
|
||||
BOOST_TEST( !( p < p2 ) && !( p2 < p ) );
|
||||
}
|
||||
}
|
||||
shared_memory_object::remove(process_name.c_str());
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -548,6 +625,8 @@ int main()
|
||||
if(0 != basic_shared_ptr_test())
|
||||
return 1;
|
||||
|
||||
test_alias();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ int string_test()
|
||||
std::sprintf(buffer, "%i", i);
|
||||
auxShmString += buffer;
|
||||
auxStdString += buffer;
|
||||
shmStringVect->push_back(move(auxShmString));
|
||||
shmStringVect->push_back(detail::move_impl(auxShmString));
|
||||
stdStringVect->push_back(auxStdString);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ int string_test()
|
||||
std::sprintf(buffer, "%i", i);
|
||||
auxShmString += buffer;
|
||||
auxStdString += buffer;
|
||||
shmStringVect->insert(shmStringVect->begin(), move(auxShmString));
|
||||
shmStringVect->insert(shmStringVect->begin(), detail::move_impl(auxShmString));
|
||||
stdStringVect->insert(stdStringVect->begin(), auxStdString);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@ int main()
|
||||
|
||||
//Test some copy constructors
|
||||
my_unique_ptr_class my_ptr3(0, segment.get_deleter<MyClass>());
|
||||
my_unique_ptr_class my_ptr4(move(my_ptr3));
|
||||
my_unique_ptr_class my_ptr4(detail::move_impl(my_ptr3));
|
||||
|
||||
//Construct a list and fill
|
||||
MyList list(segment.get_segment_manager());
|
||||
|
||||
//Insert from my_unique_ptr_class
|
||||
list.push_front(move(my_ptr));
|
||||
list.push_back(move(my_ptr2));
|
||||
list.push_front(detail::move_impl(my_ptr));
|
||||
list.push_back(detail::move_impl(my_ptr2));
|
||||
|
||||
//Check pointers
|
||||
assert(my_ptr.get() == 0);
|
||||
@@ -85,9 +85,9 @@ int main()
|
||||
assert(list.begin()->get() == ptr1);
|
||||
assert(list.rbegin()->get() == ptr2);
|
||||
|
||||
//MyList list2(move(list));
|
||||
//list2.swap(move(MyList(segment.get_segment_manager())));
|
||||
//list.swap(move(MyList(segment.get_segment_manager())));
|
||||
//MyList list2(detail::move_impl(list));
|
||||
//list2.swap(detail::move_impl(MyList(segment.get_segment_manager())));
|
||||
//list.swap(detail::move_impl(MyList(segment.get_segment_manager())));
|
||||
|
||||
assert(list.begin()->get() == ptr1);
|
||||
assert(list.rbegin()->get() == ptr2);
|
||||
@@ -97,8 +97,8 @@ int main()
|
||||
MySet set(set_less_t(), segment.get_segment_manager());
|
||||
|
||||
//Insert in set from list passing ownership
|
||||
set.insert(move(*list.begin()));
|
||||
set.insert(move(*list.rbegin()));
|
||||
set.insert(detail::move_impl(*list.begin()));
|
||||
set.insert(detail::move_impl(*list.rbegin()));
|
||||
|
||||
//Check pointers
|
||||
assert(list.begin()->get() == 0);
|
||||
@@ -120,12 +120,12 @@ int main()
|
||||
|
||||
//Insert from my_unique_ptr_class
|
||||
if(ptr1 < ptr2){
|
||||
vector.insert(vector.begin(), move(*set.begin()));
|
||||
vector.insert(vector.end(), move(*set.rbegin()));
|
||||
vector.insert(vector.begin(), detail::move_impl(*set.begin()));
|
||||
vector.insert(vector.end(), detail::move_impl(*set.rbegin()));
|
||||
}
|
||||
else{
|
||||
vector.insert(vector.begin(), move(*set.rbegin()));
|
||||
vector.insert(vector.end(), move(*set.begin()));
|
||||
vector.insert(vector.begin(), detail::move_impl(*set.rbegin()));
|
||||
vector.insert(vector.end(), detail::move_impl(*set.begin()));
|
||||
}
|
||||
|
||||
//Check pointers
|
||||
@@ -134,14 +134,14 @@ int main()
|
||||
assert(vector.begin()->get() == ptr1);
|
||||
assert(vector.rbegin()->get() == ptr2);
|
||||
|
||||
MyVector vector2(move(vector));
|
||||
MyVector vector2(detail::move_impl(vector));
|
||||
vector2.swap(vector);
|
||||
|
||||
assert(vector.begin()->get() == ptr1);
|
||||
assert(vector.rbegin()->get() == ptr2);
|
||||
|
||||
my_unique_ptr_class a(0, segment.get_deleter<MyClass>()), b(0, segment.get_deleter<MyClass>());
|
||||
a = move(b);
|
||||
a = detail::move_impl(b);
|
||||
}
|
||||
shared_memory_object::remove(process_name.c_str());
|
||||
return 0;
|
||||
|
||||
@@ -35,135 +35,135 @@ int main ()
|
||||
//Conversions to scoped_lock
|
||||
{
|
||||
scoped_lock<Mutex> lock(mut);
|
||||
scoped_lock<Mutex> e_lock(move(lock));
|
||||
lock.swap(move(e_lock));
|
||||
scoped_lock<Mutex> e_lock(detail::move_impl(lock));
|
||||
lock.swap(detail::move_impl(e_lock));
|
||||
}
|
||||
{
|
||||
scoped_lock<Mutex> lock(mut);
|
||||
scoped_lock<Mutex> e_lock(mut2);
|
||||
e_lock = move(lock);
|
||||
e_lock = detail::move_impl(lock);
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(move(u_lock));
|
||||
scoped_lock<Mutex> e_lock(detail::move_impl(u_lock));
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(mut2);
|
||||
scoped_lock<Mutex> moved(move(u_lock));
|
||||
e_lock = move(moved);
|
||||
scoped_lock<Mutex> moved(detail::move_impl(u_lock));
|
||||
e_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls try_unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(move(u_lock), try_to_lock);
|
||||
scoped_lock<Mutex> e_lock(detail::move_impl(u_lock), try_to_lock);
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls try_unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(mut2);
|
||||
scoped_lock<Mutex> moved(move(u_lock), try_to_lock);
|
||||
e_lock = move(moved);
|
||||
scoped_lock<Mutex> moved(detail::move_impl(u_lock), try_to_lock);
|
||||
e_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
boost::posix_time::ptime t = test::delay(100);
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls timed_unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(move(u_lock), t);
|
||||
scoped_lock<Mutex> e_lock(detail::move_impl(u_lock), t);
|
||||
}
|
||||
{
|
||||
boost::posix_time::ptime t = test::delay(100);
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls timed_unlock_upgradable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(mut2);
|
||||
scoped_lock<Mutex> moved(move(u_lock), t);
|
||||
e_lock = move(moved);
|
||||
scoped_lock<Mutex> moved(detail::move_impl(u_lock), t);
|
||||
e_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
sharable_lock<Mutex> s_lock(mut);
|
||||
//This calls try_unlock_sharable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(move(s_lock), try_to_lock);
|
||||
scoped_lock<Mutex> e_lock(detail::move_impl(s_lock), try_to_lock);
|
||||
}
|
||||
{
|
||||
sharable_lock<Mutex> s_lock(mut);
|
||||
//This calls try_unlock_sharable_and_lock()
|
||||
scoped_lock<Mutex> e_lock(mut2);
|
||||
scoped_lock<Mutex> moved(move(s_lock), try_to_lock);
|
||||
e_lock = move(moved);
|
||||
scoped_lock<Mutex> moved(detail::move_impl(s_lock), try_to_lock);
|
||||
e_lock = detail::move_impl(moved);
|
||||
}
|
||||
//Conversions to upgradable_lock
|
||||
{
|
||||
upgradable_lock<Mutex> lock(mut);
|
||||
upgradable_lock<Mutex> u_lock(move(lock));
|
||||
lock.swap(move(u_lock));
|
||||
upgradable_lock<Mutex> u_lock(detail::move_impl(lock));
|
||||
lock.swap(detail::move_impl(u_lock));
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> lock(mut);
|
||||
upgradable_lock<Mutex> u_lock(mut2);
|
||||
upgradable_lock<Mutex> moved(move(lock));
|
||||
u_lock = move(moved);
|
||||
upgradable_lock<Mutex> moved(detail::move_impl(lock));
|
||||
u_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
sharable_lock<Mutex> s_lock(mut);
|
||||
//This calls unlock_sharable_and_lock_upgradable()
|
||||
upgradable_lock<Mutex> u_lock(move(s_lock), try_to_lock);
|
||||
upgradable_lock<Mutex> u_lock(detail::move_impl(s_lock), try_to_lock);
|
||||
}
|
||||
{
|
||||
sharable_lock<Mutex> s_lock(mut);
|
||||
//This calls unlock_sharable_and_lock_upgradable()
|
||||
upgradable_lock<Mutex> u_lock(mut2);
|
||||
upgradable_lock<Mutex> moved(move(s_lock), try_to_lock);
|
||||
u_lock = move(moved);
|
||||
upgradable_lock<Mutex> moved(detail::move_impl(s_lock), try_to_lock);
|
||||
u_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
scoped_lock<Mutex> e_lock(mut);
|
||||
//This calls unlock_and_lock_upgradable()
|
||||
upgradable_lock<Mutex> u_lock(move(e_lock));
|
||||
upgradable_lock<Mutex> u_lock(detail::move_impl(e_lock));
|
||||
}
|
||||
{
|
||||
scoped_lock<Mutex> e_lock(mut);
|
||||
//This calls unlock_and_lock_upgradable()
|
||||
upgradable_lock<Mutex> u_lock(mut2);
|
||||
upgradable_lock<Mutex> moved(move(e_lock));
|
||||
u_lock = move(moved);
|
||||
upgradable_lock<Mutex> moved(detail::move_impl(e_lock));
|
||||
u_lock = detail::move_impl(moved);
|
||||
}
|
||||
//Conversions to sharable_lock
|
||||
{
|
||||
sharable_lock<Mutex> lock(mut);
|
||||
sharable_lock<Mutex> s_lock(move(lock));
|
||||
lock.swap(move(s_lock));
|
||||
sharable_lock<Mutex> s_lock(detail::move_impl(lock));
|
||||
lock.swap(detail::move_impl(s_lock));
|
||||
}
|
||||
{
|
||||
sharable_lock<Mutex> lock(mut);
|
||||
sharable_lock<Mutex> s_lock(mut2);
|
||||
sharable_lock<Mutex> moved(move(lock));
|
||||
s_lock = move(moved);
|
||||
sharable_lock<Mutex> moved(detail::move_impl(lock));
|
||||
s_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls unlock_upgradable_and_lock_sharable()
|
||||
sharable_lock<Mutex> s_lock(move(u_lock));
|
||||
sharable_lock<Mutex> s_lock(detail::move_impl(u_lock));
|
||||
}
|
||||
{
|
||||
upgradable_lock<Mutex> u_lock(mut);
|
||||
//This calls unlock_upgradable_and_lock_sharable()
|
||||
sharable_lock<Mutex> s_lock(mut2);
|
||||
sharable_lock<Mutex> moved(move(u_lock));
|
||||
s_lock = move(moved);
|
||||
sharable_lock<Mutex> moved(detail::move_impl(u_lock));
|
||||
s_lock = detail::move_impl(moved);
|
||||
}
|
||||
{
|
||||
scoped_lock<Mutex> e_lock(mut);
|
||||
//This calls unlock_and_lock_sharable()
|
||||
sharable_lock<Mutex> s_lock(move(e_lock));
|
||||
sharable_lock<Mutex> s_lock(detail::move_impl(e_lock));
|
||||
}
|
||||
{
|
||||
scoped_lock<Mutex> e_lock(mut);
|
||||
//This calls unlock_and_lock_sharable()
|
||||
sharable_lock<Mutex> s_lock(mut2);
|
||||
sharable_lock<Mutex> moved(move(e_lock));
|
||||
s_lock = move(moved);
|
||||
sharable_lock<Mutex> moved(detail::move_impl(e_lock));
|
||||
s_lock = detail::move_impl(moved);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,13 +65,13 @@ int main ()
|
||||
//Test move semantics
|
||||
{
|
||||
wmanaged_external_buffer user_default;
|
||||
wmanaged_external_buffer temp_external(move(user_buffer));
|
||||
user_default = move(temp_external);
|
||||
user_buffer = move(user_default);
|
||||
wmanaged_external_buffer temp_external(detail::move_impl(user_buffer));
|
||||
user_default = detail::move_impl(temp_external);
|
||||
user_buffer = detail::move_impl(user_default);
|
||||
wmanaged_heap_memory heap_default;
|
||||
wmanaged_heap_memory temp_heap(move(heap_buffer));
|
||||
heap_default = move(temp_heap);
|
||||
heap_buffer = move(heap_default);
|
||||
wmanaged_heap_memory temp_heap(detail::move_impl(heap_buffer));
|
||||
heap_default = detail::move_impl(temp_heap);
|
||||
heap_buffer = detail::move_impl(heap_default);
|
||||
}
|
||||
|
||||
//Initialize memory
|
||||
|
||||
@@ -48,18 +48,18 @@ bool copyable_only(V1 *shmvector, V2 *stdvector, detail::true_type)
|
||||
{
|
||||
IntType move_me(1);
|
||||
stdvector->insert(stdvector->begin()+size/2, 50, 1);
|
||||
shmvector->insert(shmvector->begin()+size/2, 50, move(move_me));
|
||||
shmvector->insert(shmvector->begin()+size/2, 50, detail::move_impl(move_me));
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return false;
|
||||
}
|
||||
{
|
||||
IntType move_me(2);
|
||||
shmvector->assign(shmvector->size()/2, move(move_me));
|
||||
shmvector->assign(shmvector->size()/2, detail::move_impl(move_me));
|
||||
stdvector->assign(stdvector->size()/2, 2);
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return false;
|
||||
}
|
||||
{
|
||||
IntType move_me(3);
|
||||
shmvector->assign(shmvector->size()*3-1, move(move_me));
|
||||
shmvector->assign(shmvector->size()*3-1, detail::move_impl(move_me));
|
||||
stdvector->assign(stdvector->size()*3-1, 3);
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return false;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ int vector_test()
|
||||
|
||||
for(int i = 0; i < max; ++i){
|
||||
IntType new_int(i);
|
||||
shmvector->insert(shmvector->end(), move(new_int));
|
||||
shmvector->insert(shmvector->end(), detail::move_impl(new_int));
|
||||
stdvector->insert(stdvector->end(), i);
|
||||
}
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return 1;
|
||||
@@ -131,7 +131,7 @@ int vector_test()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType new_int(-1);
|
||||
aux_vect[i] = move(new_int);
|
||||
aux_vect[i] = detail::move_impl(new_int);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -154,7 +154,7 @@ int vector_test()
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
IntType new_int(-1);
|
||||
aux_vect[i] = move(new_int);
|
||||
aux_vect[i] = detail::move_impl(new_int);
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
@@ -172,7 +172,7 @@ int vector_test()
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return 1;
|
||||
|
||||
IntType push_back_this(1);
|
||||
shmvector->push_back(move(push_back_this));
|
||||
shmvector->push_back(detail::move_impl(push_back_this));
|
||||
stdvector->push_back(int(1));
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return 1;
|
||||
|
||||
@@ -187,7 +187,7 @@ int vector_test()
|
||||
|
||||
for(int i = 0; i < max; ++i){
|
||||
IntType insert_this(i);
|
||||
shmvector->insert(shmvector->begin(), move(insert_this));
|
||||
shmvector->insert(shmvector->begin(), detail::move_impl(insert_this));
|
||||
stdvector->insert(stdvector->begin(), i);
|
||||
}
|
||||
if(!test::CheckEqualContainers(shmvector, stdvector)) return 1;
|
||||
|
||||
Reference in New Issue
Block a user