mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Source breaking: A shared memory object is now used including shared_memory_object.hpp header instead of shared memory.hpp. ABI breaking: Changed global mutex when initializing managed shared memory and memory mapped files. This change tries to minimize deadlocks. Source breaking: Changed shared memory, memory mapped files and mapped region's open mode to a single boost::interprocess::mode_t type. Added extra WIN32_LEAN_AND_MEAN before including DateTime headers to avoid socket redefinition errors when using Interprocess and Asio in windows. ABI breaking: mapped_region constructor no longer requires classes derived from memory_mappable, but classes the fulfill the MemoryMappable concept. Added in-place reallocation capabilities to basic_string. ABI breaking: Reimplemented and optimized small string optimization. The narrow string class has zero byte overhead with an internal 11 byte buffer in 32 systems! Added move semantics to containers. Experimental and not documented yet. Improves performance when using containers of containers. ABI breaking: End nodes of node containers (list, slist, map/set) are now embedded in the containers instead of allocated using the allocator. This allows no-throw move-constructors and improves performance. ABI breaking: slist and list containers now have constant-time size() function. The size of the container is added as a member. [SVN r35618]
71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
//////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// (C) Copyright Ion Gaztañaga 2006. 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.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef BOOST_INTERPROCESS_TEST_CHECK_EQUAL_CONTAINERS_HPP
|
|
#define BOOST_INTERPROCESS_TEST_CHECK_EQUAL_CONTAINERS_HPP
|
|
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
#include <boost/interprocess/detail/config_begin.hpp>
|
|
|
|
namespace boost{
|
|
namespace interprocess{
|
|
namespace test{
|
|
|
|
//Function to check if both containers are equal
|
|
template<class MyShmCont
|
|
,class MyStdCont>
|
|
bool CheckEqualContainers(MyShmCont *shmcont, MyStdCont *stdcont)
|
|
{
|
|
if(shmcont->size() != stdcont->size())
|
|
return false;
|
|
|
|
typedef typename MyShmCont::value_type value_type;
|
|
|
|
typename MyShmCont::iterator itshm(shmcont->begin()), itshmend(shmcont->end());
|
|
typename MyStdCont::iterator itstd(stdcont->begin());
|
|
for(; itshm != itshmend; ++itshm, ++itstd){
|
|
value_type val(*itstd);
|
|
if(*itshm != val)
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
template<class MyShmCont
|
|
,class MyStdCont>
|
|
bool CheckEqualPairContainers(MyShmCont *shmcont, MyStdCont *stdcont)
|
|
{
|
|
if(shmcont->size() != stdcont->size())
|
|
return false;
|
|
|
|
typedef typename MyShmCont::key_type key_type;
|
|
typedef typename MyShmCont::mapped_type mapped_type;
|
|
|
|
typename MyShmCont::iterator itshm(shmcont->begin()), itshmend(shmcont->end());
|
|
typename MyStdCont::iterator itstd(stdcont->begin());
|
|
for(; itshm != itshmend; ++itshm, ++itstd){
|
|
if(itshm->first != key_type(itstd->first))
|
|
return false;
|
|
|
|
if(itshm->second != mapped_type(itstd->second))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
} //namespace test{
|
|
} //namespace interprocess{
|
|
} //namespace boost{
|
|
|
|
#include <boost/interprocess/detail/config_end.hpp>
|
|
|
|
#endif //#ifndef BOOST_INTERPROCESS_TEST_CHECK_EQUAL_CONTAINERS_HPP
|