From de72bbf2d86af275808a90dbcf3bfbf3728cdcbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 10 Jul 2014 21:38:52 +0200 Subject: [PATCH] Fixed vector_test and cleaned up intermodule singleton code. --- .../detail/intermodule_singleton.hpp | 3 ++- .../detail/managed_open_or_create_impl.hpp | 1 - .../interprocess/detail/robust_emulation.hpp | 1 + .../detail/windows_intermodule_singleton.hpp | 4 ++-- test/expand_bwd_test_template.hpp | 22 +++++++++---------- test/intermodule_singleton_test.cpp | 1 + 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/boost/interprocess/detail/intermodule_singleton.hpp b/include/boost/interprocess/detail/intermodule_singleton.hpp index 46c78b1..7d9dcd5 100644 --- a/include/boost/interprocess/detail/intermodule_singleton.hpp +++ b/include/boost/interprocess/detail/intermodule_singleton.hpp @@ -20,8 +20,9 @@ #ifdef BOOST_INTERPROCESS_WINDOWS #include +#else + #include #endif -#include namespace boost{ namespace interprocess{ diff --git a/include/boost/interprocess/detail/managed_open_or_create_impl.hpp b/include/boost/interprocess/detail/managed_open_or_create_impl.hpp index 596a14a..f12d6c6 100644 --- a/include/boost/interprocess/detail/managed_open_or_create_impl.hpp +++ b/include/boost/interprocess/detail/managed_open_or_create_impl.hpp @@ -310,7 +310,6 @@ class managed_open_or_create_impl { typedef bool_ file_like_t; (void)mode; - error_info err; bool created = false; bool ronly = false; bool cow = false; diff --git a/include/boost/interprocess/detail/robust_emulation.hpp b/include/boost/interprocess/detail/robust_emulation.hpp index f47b4ae..89f4987 100644 --- a/include/boost/interprocess/detail/robust_emulation.hpp +++ b/include/boost/interprocess/detail/robust_emulation.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/interprocess/detail/windows_intermodule_singleton.hpp b/include/boost/interprocess/detail/windows_intermodule_singleton.hpp index b05ee62..041557a 100644 --- a/include/boost/interprocess/detail/windows_intermodule_singleton.hpp +++ b/include/boost/interprocess/detail/windows_intermodule_singleton.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace boost{ namespace interprocess{ @@ -49,7 +49,7 @@ namespace intermodule_singleton_helpers { // max and current semaphore count. class windows_semaphore_based_map { - typedef std::map map_type; + typedef boost::container::map map_type; public: windows_semaphore_based_map() diff --git a/test/expand_bwd_test_template.hpp b/test/expand_bwd_test_template.hpp index 3261898..25c70c9 100644 --- a/test/expand_bwd_test_template.hpp +++ b/test/expand_bwd_test_template.hpp @@ -185,8 +185,8 @@ bool test_assign_with_expand_bwd() const int Offset[] = { 50, 50, 50}; const int InitialSize[] = { 25, 25, 25}; - const int AssignSize[] = { 40, 60, 80}; - const int Iterations = sizeof(AssignSize)/sizeof(int); + const int InsertSize[] = { 15, 35, 55}; + const int Iterations = sizeof(InsertSize)/sizeof(int); for(int iteration = 0; iteration data_to_assign; - data_to_assign.resize(AssignSize[iteration]); - for(int i = 0; i < AssignSize[iteration]; ++i){ - data_to_assign[i] = -i; + //Create data to insert + std::vector data_to_insert; + data_to_insert.resize(InsertSize[iteration]); + for(int i = 0; i < InsertSize[iteration]; ++i){ + data_to_insert[i] = -i; } //Insert initial data to the vector to test @@ -213,13 +213,13 @@ bool test_assign_with_expand_bwd() vector.insert( vector.begin() , initial_data.begin(), initial_data.end()); - //Assign data - vector.assign(data_to_assign.begin(), data_to_assign.end()); - initial_data.assign(data_to_assign.begin(), data_to_assign.end()); + //Insert data + vector.insert(vector.cbegin(), data_to_insert.begin(), data_to_insert.end()); + initial_data.insert(initial_data.begin(), data_to_insert.begin(), data_to_insert.end()); //Now check that values are equal if(!CheckEqualVector(vector, initial_data)){ - std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl + std::cout << "test_insert_with_expand_bwd::CheckEqualVector failed." << std::endl << " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl << " Iteration: " << iteration << std::endl; return false; diff --git a/test/intermodule_singleton_test.cpp b/test/intermodule_singleton_test.cpp index 15d6105..c66fa98 100644 --- a/test/intermodule_singleton_test.cpp +++ b/test/intermodule_singleton_test.cpp @@ -9,6 +9,7 @@ ////////////////////////////////////////////////////////////////////////////// #include #include +#include #include using namespace boost::interprocess;