|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77481 - in trunk/libs/container: . doc example proj proj/vc7ide test
From: igaztanaga_at_[hidden]
Date: 2012-03-22 14:49:00
Author: igaztanaga
Date: 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
New Revision: 77481
URL: http://svn.boost.org/trac/boost/changeset/77481
Log:
Experimental scoped_allocator support
Added:
trunk/libs/container/proj/vc7ide/scoped_allocator_adaptor.vcproj (contents, props changed)
trunk/libs/container/test/scoped_allocator_adaptor_test.cpp (contents, props changed)
Text files modified:
trunk/libs/container/doc/Jamfile.v2 | 4 +++-
trunk/libs/container/doc/container.qbk | 12 ++++++------
trunk/libs/container/example/doc_emplace.cpp | 2 +-
trunk/libs/container/example/doc_move_containers.cpp | 2 +-
trunk/libs/container/example/doc_recursive_containers.cpp | 2 +-
trunk/libs/container/example/doc_type_erasure.cpp | 2 +-
trunk/libs/container/index.html | 2 +-
trunk/libs/container/proj/to-do.txt | 17 +++++------------
trunk/libs/container/proj/vc7ide/container.sln | 8 ++++++++
trunk/libs/container/proj/vc7ide/container.vcproj | 22 +++++++++-------------
trunk/libs/container/test/allocator_traits_test.cpp | 4 ++--
trunk/libs/container/test/deque_test.cpp | 2 +-
trunk/libs/container/test/dummy_test_allocator.hpp | 6 +++---
trunk/libs/container/test/expand_bwd_test_allocator.hpp | 6 +++---
trunk/libs/container/test/flat_tree_test.cpp | 8 ++++----
trunk/libs/container/test/heap_allocator_v1.hpp | 2 +-
trunk/libs/container/test/list_test.cpp | 2 +-
trunk/libs/container/test/pair_test.cpp | 2 +-
trunk/libs/container/test/print_container.hpp | 2 +-
trunk/libs/container/test/set_test.hpp | 2 +-
trunk/libs/container/test/slist_test.cpp | 2 +-
trunk/libs/container/test/stable_vector_test.cpp | 2 +-
trunk/libs/container/test/string_test.cpp | 2 +-
trunk/libs/container/test/tree_test.cpp | 4 +++-
trunk/libs/container/test/util.hpp | 2 +-
trunk/libs/container/test/vector_test.cpp | 25 +++++++++++++++++++++++--
trunk/libs/container/test/vector_test.hpp | 2 +-
27 files changed, 85 insertions(+), 63 deletions(-)
Modified: trunk/libs/container/doc/Jamfile.v2
==============================================================================
--- trunk/libs/container/doc/Jamfile.v2 (original)
+++ trunk/libs/container/doc/Jamfile.v2 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
# Boost.Container library documentation Jamfile ---------------------------------
#
-# Copyright Ion Gaztanaga 2009-2011. Use, modification and
+# Copyright Ion Gaztanaga 2009-2012. Use, modification and
# distribution is subject to 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)
@@ -27,6 +27,8 @@
<doxygen:param>"PREDEFINED=\"insert_const_ref_type= const T&\" \\
\"BOOST_CONTAINER_DOXYGEN_INVOKED\" \\
\"BOOST_RV_REF(T)=T &&\" \\
+ \"BOOST_RV_REF_BEG=\" \\
+ \"BOOST_RV_REF_END=&&\" \\
\"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\
\"BOOST_RV_REF_2_TEMPL_ARGS(T,a,b)=T<a, b> &&\" \\
\"BOOST_RV_REF_3_TEMPL_ARGS(T,a,b,c)=T<a,b,c>T<a,b,c> &&\" \\
Modified: trunk/libs/container/doc/container.qbk
==============================================================================
--- trunk/libs/container/doc/container.qbk (original)
+++ trunk/libs/container/doc/container.qbk 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,5 +1,5 @@
[/
- / Copyright (c) 2009-2011 Ion Gazta\u00F1aga
+ / Copyright (c) 2009-2012 Ion Gazta\u00F1aga
/
/ 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)
@@ -8,7 +8,7 @@
[library Boost.Container
[quickbook 1.5]
[authors [Gaztanaga, Ion]]
- [copyright 2009-2011 Ion Gaztanaga]
+ [copyright 2009-2012 Ion Gaztanaga]
[id container]
[dirname container]
[purpose Containers library]
@@ -37,9 +37,9 @@
(they can be safely placed in shared memory).
* The library offers new useful containers:
* [classref boost::container::flat_map flat_map],
- [classref boost::container::flat_map flat_set],
- [classref boost::container::flat_map flat_multiset] and
- [classref boost::container::flat_map flat_multiset]: drop-in
+ [classref boost::container::flat_set flat_set],
+ [classref boost::container::flat_multiset flat_multiset] and
+ [classref boost::container::flat_multiset flat_multiset]: drop-in
replacements for standard associative containers but more memory friendly and with faster
searches.
* [classref boost::container::stable_vector stable_vector]: a std::list and std::vector hybrid
@@ -378,7 +378,7 @@
should probably use list instead of slist.]]
[*Boost.Container] updates the classic `slist` container with C++11 features like move semantics and placement
-insertion and implements it a bit differently for the standard C++11 `forward_list`. `forward_list` has no `size()`
+insertion and implements it a bit differently than the standard C++ `forward_list`. `forward_list` has no `size()`
method, so it's been designed to allow (or in practice, encourage) implementations without tracking list size
with every insertion/erasure, allowing constant-time
`splice_after(iterator, forward_list &, iterator, iterator)`-based list merging. On the other hand `slist` offers
Modified: trunk/libs/container/example/doc_emplace.cpp
==============================================================================
--- trunk/libs/container/example/doc_emplace.cpp (original)
+++ trunk/libs/container/example/doc_emplace.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2012. 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)
//
Modified: trunk/libs/container/example/doc_move_containers.cpp
==============================================================================
--- trunk/libs/container/example/doc_move_containers.cpp (original)
+++ trunk/libs/container/example/doc_move_containers.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2012. 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)
//
Modified: trunk/libs/container/example/doc_recursive_containers.cpp
==============================================================================
--- trunk/libs/container/example/doc_recursive_containers.cpp (original)
+++ trunk/libs/container/example/doc_recursive_containers.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2012. 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)
//
Modified: trunk/libs/container/example/doc_type_erasure.cpp
==============================================================================
--- trunk/libs/container/example/doc_type_erasure.cpp (original)
+++ trunk/libs/container/example/doc_type_erasure.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2009-2012. 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)
//
Modified: trunk/libs/container/index.html
==============================================================================
--- trunk/libs/container/index.html (original)
+++ trunk/libs/container/index.html 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,5 +1,5 @@
<!--
-Copyright 2005-2011 Ion Gaztanaga
+Copyright 2005-2012 Ion Gaztanaga
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)
-->
Modified: trunk/libs/container/proj/to-do.txt
==============================================================================
--- trunk/libs/container/proj/to-do.txt (original)
+++ trunk/libs/container/proj/to-do.txt 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,10 +1,10 @@
->Change "insert" and "push_back"/"push_front" to catch non-const rvalues
->Add an example with stateful allocators
->Add test to check convertible types in push_back/insert
+->Add SCARY iterators.
Review allocator traits
--> Explicit instantiation of simple allocator & std::allocator to detect missing allocator_traits calls
-> Avoid any rebind<>::other
-> Review select_on_container_copy_xxx
-> Review propagate_on_xxx
@@ -12,13 +12,13 @@
-> Default + swap move constructors correct?
-> Review container documentation in swap/copy/move regarding allocators
-Check all move constructors: swap might not be a valid idiom, allocators must be move constructed, intrusive containers are now movable
+Check all move constructors: swap might not be a valid idiom, allocators must be move constructed,
+intrusive containers are now movable
Add and test:
Test different propagation values and with inequal allocators
-
propagate_on_container_move_assignment
select_on_container_copy_construction
propagate_on_container_swap
@@ -28,19 +28,12 @@
An allocator should use a smart allocator not constructible from raw pointers to catch missing pointer_traits calls
-Review all internal container swap's to check allocator propagation is correct
-
Add initializer lists
Write forward_list
-Review all move constructors to test if allocator is move constructed
-
check move if noexcept conditions in vector, deque and stable_vector
-Add new allocator propagation copy constructors
-
-Review all destructors (search for "~") to detect placement destruction and replace it with allocator_traits::destroy
+Detect always equal or unequal allocators at compiler time. operator== returns true_type or false_type
-All functions from base classes like vector_base, node_alloc_holder, etc., should be named with underscore or
-similar to avoid namespace pollution.
\ No newline at end of file
+change virtual functions with pointers to avoid template instantiation for every type
\ No newline at end of file
Modified: trunk/libs/container/proj/vc7ide/container.sln
==============================================================================
--- trunk/libs/container/proj/vc7ide/container.sln (original)
+++ trunk/libs/container/proj/vc7ide/container.sln 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -43,6 +43,10 @@
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_allocator_adaptor_test", "scoped_allocator_adaptor.vcproj", "{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -95,6 +99,10 @@
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.Build.0 = Release|Win32
+ {B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.ActiveCfg = Debug|Win32
+ {B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.Build.0 = Debug|Win32
+ {B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.ActiveCfg = Release|Win32
+ {B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Modified: trunk/libs/container/proj/vc7ide/container.vcproj
==============================================================================
--- trunk/libs/container/proj/vc7ide/container.vcproj (original)
+++ trunk/libs/container/proj/vc7ide/container.vcproj 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -180,6 +180,9 @@
Name="container"
Filter="">
<File
+ RelativePath="..\..\..\..\boost\container\allocator_traits.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\boost\container\container_fwd.hpp">
</File>
<File
@@ -198,6 +201,9 @@
RelativePath="..\..\..\..\boost\container\map.hpp">
</File>
<File
+ RelativePath="..\..\..\..\boost\container\scoped_allocator.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\boost\container\set.hpp">
</File>
<File
@@ -216,19 +222,6 @@
RelativePath="..\..\..\..\boost\container\vector.hpp">
</File>
<Filter
- Name="allocator"
- Filter="">
- <File
- RelativePath="..\..\..\..\boost\container\allocator\allocator_traits.hpp">
- </File>
- <File
- RelativePath="..\..\..\..\boost\container\allocator\memory_util.hpp">
- </File>
- <File
- RelativePath="..\..\..\..\boost\container\allocator\scoped_allocator.hpp">
- </File>
- </Filter>
- <Filter
Name="detail"
Filter="">
<File
@@ -265,6 +258,9 @@
RelativePath="..\..\..\..\boost\container\detail\math_functions.hpp">
</File>
<File
+ RelativePath="..\..\..\..\boost\container\allocator\memory_util.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\boost\container\detail\mpl.hpp">
</File>
<File
Added: trunk/libs/container/proj/vc7ide/scoped_allocator_adaptor.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/container/proj/vc7ide/scoped_allocator_adaptor.vcproj 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="scoped_allocator_adaptor_test"
+ ProjectGUID="{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/scoped_allocator_adaptor_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ GeneratePreprocessedFile="0"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/scoped_allocator_adaptor_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/scoped_allocator_adaptor_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/scoped_allocator_adaptor_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/scoped_allocator_adaptor_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{41737BCF-4312-7AC5-A066-32D75A32A2AF}">
+ <File
+ RelativePath="..\..\test\scoped_allocator_adaptor_test.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: trunk/libs/container/test/allocator_traits_test.cpp
==============================================================================
--- trunk/libs/container/test/allocator_traits_test.cpp (original)
+++ trunk/libs/container/test/allocator_traits_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. 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)
//
@@ -9,7 +9,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <cstddef>
-#include <boost/container/allocator/allocator_traits.hpp>
+#include <boost/container/allocator_traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/integral_constant.hpp>
Modified: trunk/libs/container/test/deque_test.cpp
==============================================================================
--- trunk/libs/container/test/deque_test.cpp (original)
+++ trunk/libs/container/test/deque_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/dummy_test_allocator.hpp
==============================================================================
--- trunk/libs/container/test/dummy_test_allocator.hpp (original)
+++ trunk/libs/container/test/dummy_test_allocator.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
//
@@ -112,10 +112,10 @@
{}
pointer address(reference value)
- { return pointer(addressof(value)); }
+ { return pointer(container_detail::addressof(value)); }
const_pointer address(const_reference value) const
- { return const_pointer(addressof(value)); }
+ { return const_pointer(container_detail::addressof(value)); }
pointer allocate(size_type, cvoid_ptr = 0)
{ return 0; }
Modified: trunk/libs/container/test/expand_bwd_test_allocator.hpp
==============================================================================
--- trunk/libs/container/test/expand_bwd_test_allocator.hpp (original)
+++ trunk/libs/container/test/expand_bwd_test_allocator.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
//
@@ -86,10 +86,10 @@
, m_offset(other.m_offset), m_allocations(0){ }
pointer address(reference value)
- { return pointer(addressof(value)); }
+ { return pointer(container_detail::addressof(value)); }
const_pointer address(const_reference value) const
- { return const_pointer(addressof(value)); }
+ { return const_pointer(container_detail::addressof(value)); }
pointer allocate(size_type , cvoid_ptr hint = 0)
{ (void)hint; return 0; }
Modified: trunk/libs/container/test/flat_tree_test.cpp
==============================================================================
--- trunk/libs/container/test/flat_tree_test.cpp (original)
+++ trunk/libs/container/test/flat_tree_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
@@ -228,17 +228,17 @@
{
public:
recursive_flat_multiset(const recursive_flat_multiset &c)
- : id_(c.id_), flat_set_(c.flat_set_)
+ : id_(c.id_), flat_multiset_(c.flat_multiset_)
{}
recursive_flat_multiset & operator =(const recursive_flat_multiset &c)
{
id_ = c.id_;
- flat_set_= c.flat_set_;
+ flat_multiset_= c.flat_multiset_;
return *this;
}
int id_;
- flat_multiset<recursive_flat_multiset> flat_set_;
+ flat_multiset<recursive_flat_multiset> flat_multiset_;
friend bool operator< (const recursive_flat_multiset &a, const recursive_flat_multiset &b)
{ return a.id_ < b.id_; }
};
Modified: trunk/libs/container/test/heap_allocator_v1.hpp
==============================================================================
--- trunk/libs/container/test/heap_allocator_v1.hpp (original)
+++ trunk/libs/container/test/heap_allocator_v1.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
//
Modified: trunk/libs/container/test/list_test.cpp
==============================================================================
--- trunk/libs/container/test/list_test.cpp (original)
+++ trunk/libs/container/test/list_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/pair_test.cpp
==============================================================================
--- trunk/libs/container/test/pair_test.cpp (original)
+++ trunk/libs/container/test/pair_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. 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)
//
Modified: trunk/libs/container/test/print_container.hpp
==============================================================================
--- trunk/libs/container/test/print_container.hpp (original)
+++ trunk/libs/container/test/print_container.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Added: trunk/libs/container/test/scoped_allocator_adaptor_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/container/test/scoped_allocator_adaptor_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -0,0 +1,1404 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2012. 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/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/scoped_allocator.hpp>
+#include <cstddef>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/container/detail/function_detector.hpp>
+#include <boost/container/detail/mpl.hpp>
+#include <boost/move/move.hpp>
+#include <memory>
+#include <boost/container/vector.hpp>
+#include <boost/container/detail/pair.hpp>
+
+using namespace boost::container;
+
+
+template<class T, unsigned int Id, bool Propagate = false>
+class test_allocator
+{
+ BOOST_COPYABLE_AND_MOVABLE(test_allocator)
+ public:
+
+ template<class U>
+ struct rebind
+ {
+ typedef test_allocator<U, Id, Propagate> other;
+ };
+
+ typedef container_detail::bool_<Propagate> propagate_on_container_copy_assignment;
+ typedef container_detail::bool_<Propagate> propagate_on_container_move_assignment;
+ typedef container_detail::bool_<Propagate> propagate_on_container_swap;
+ typedef T value_type;
+
+ test_allocator()
+ {}
+
+ test_allocator(const test_allocator&)
+ {}
+
+ test_allocator(BOOST_RV_REF(test_allocator) )
+ {}
+
+ template<class U>
+ test_allocator(BOOST_RV_REF_BEG test_allocator<U, Id, Propagate> BOOST_RV_REF_END)
+ {}
+
+ template<class U>
+ test_allocator(const test_allocator<U, Id, Propagate> &)
+ {}
+
+ test_allocator & operator=(BOOST_COPY_ASSIGN_REF(test_allocator))
+ { return *this; }
+
+ test_allocator & operator=(BOOST_RV_REF(test_allocator))
+ { return *this; }
+
+ std::size_t max_size() const
+ { return std::size_t(Id); }
+
+ T* allocate(std::size_t n)
+ { return (T*)::new char[n*sizeof(T)]; }
+
+ void deallocate(T*p, std::size_t)
+ { delete []static_cast<char*>(static_cast<void*>(p)); }
+};
+
+template <class T1, class T2, unsigned int Id, bool Propagate>
+bool operator==( const test_allocator<T1, Id, Propagate>&
+ , const test_allocator<T2, Id, Propagate>&)
+{ return true; }
+
+template <class T1, class T2, unsigned int Id, bool Propagate>
+bool operator!=( const test_allocator<T1, Id, Propagate>&
+ , const test_allocator<T2, Id, Propagate>&)
+{ return false; }
+
+
+template<unsigned int Type>
+struct tagged_integer
+{};
+
+struct mark_on_destructor
+{
+ mark_on_destructor()
+ : destroyed(false)
+ {}
+
+ ~mark_on_destructor()
+ {
+ destroyed = true;
+ }
+
+ bool destroyed;
+};
+
+//This enum lists the construction options
+//for an allocator-aware type
+enum ConstructionTypeEnum
+{
+ ConstructiblePrefix,
+ ConstructibleSuffix,
+ NotUsesAllocator,
+};
+
+//This base class provices types for
+//the derived class to implement each construction
+//type. If a construction type does not apply
+//the typedef is set to an internal nat
+//so that the class is not constructible from
+//the user arguments.
+template<ConstructionTypeEnum ConstructionType, unsigned int AllocatorTag>
+struct uses_allocator_base;
+
+template<unsigned int AllocatorTag>
+struct uses_allocator_base<ConstructibleSuffix, AllocatorTag>
+{
+ typedef test_allocator<int, AllocatorTag> allocator_type;
+ typedef allocator_type allocator_constructor_type;
+ struct nat{};
+ typedef nat allocator_arg_type;
+};
+
+template<unsigned int AllocatorTag>
+struct uses_allocator_base<ConstructiblePrefix, AllocatorTag>
+{
+ typedef test_allocator<int, AllocatorTag> allocator_type;
+ typedef allocator_type allocator_constructor_type;
+ typedef allocator_arg_t allocator_arg_type;
+};
+
+template<unsigned int AllocatorTag>
+struct uses_allocator_base<NotUsesAllocator, AllocatorTag>
+{
+ struct nat{};
+ typedef nat allocator_constructor_type;
+ typedef nat allocator_arg_type;
+};
+
+template<ConstructionTypeEnum ConstructionType, unsigned int AllocatorTag>
+struct mark_on_scoped_allocation
+ : uses_allocator_base<ConstructionType, AllocatorTag>
+{
+ private:
+ BOOST_COPYABLE_AND_MOVABLE(mark_on_scoped_allocation)
+
+ public:
+
+ typedef uses_allocator_base<ConstructionType, AllocatorTag> base_type;
+
+ //0 user argument constructors
+ mark_on_scoped_allocation()
+ : construction_type(NotUsesAllocator), value(0)
+ {}
+
+ explicit mark_on_scoped_allocation
+ (typename base_type::allocator_constructor_type)
+ : construction_type(ConstructibleSuffix), value(0)
+ {}
+
+ explicit mark_on_scoped_allocation
+ (typename base_type::allocator_arg_type, typename base_type::allocator_constructor_type)
+ : construction_type(ConstructiblePrefix), value(0)
+ {}
+
+ //1 user argument constructors
+ explicit mark_on_scoped_allocation(int i)
+ : construction_type(NotUsesAllocator), value(i)
+ {}
+
+ mark_on_scoped_allocation
+ (int i, typename base_type::allocator_constructor_type)
+ : construction_type(ConstructibleSuffix), value(i)
+ {}
+
+ mark_on_scoped_allocation
+ ( typename base_type::allocator_arg_type
+ , typename base_type::allocator_constructor_type
+ , int i)
+ : construction_type(ConstructiblePrefix), value(i)
+ {}
+
+ //Copy constructors
+ mark_on_scoped_allocation(const mark_on_scoped_allocation &other)
+ : construction_type(NotUsesAllocator), value(other.value)
+ {}
+
+ mark_on_scoped_allocation( const mark_on_scoped_allocation &other
+ , typename base_type::allocator_constructor_type)
+ : construction_type(ConstructibleSuffix), value(other.value)
+ {}
+
+ mark_on_scoped_allocation( typename base_type::allocator_arg_type
+ , typename base_type::allocator_constructor_type
+ , const mark_on_scoped_allocation &other)
+ : construction_type(ConstructiblePrefix), value(other.value)
+ {}
+
+ //Move constructors
+ mark_on_scoped_allocation(BOOST_RV_REF(mark_on_scoped_allocation) other)
+ : construction_type(NotUsesAllocator), value(other.value)
+ { other.value = 0; other.construction_type = NotUsesAllocator; }
+
+ mark_on_scoped_allocation( BOOST_RV_REF(mark_on_scoped_allocation) other
+ , typename base_type::allocator_constructor_type)
+ : construction_type(ConstructibleSuffix), value(other.value)
+ { other.value = 0; other.construction_type = ConstructibleSuffix; }
+
+ mark_on_scoped_allocation( typename base_type::allocator_arg_type
+ , typename base_type::allocator_constructor_type
+ , BOOST_RV_REF(mark_on_scoped_allocation) other)
+ : construction_type(ConstructiblePrefix), value(other.value)
+ { other.value = 0; other.construction_type = ConstructiblePrefix; }
+
+ ConstructionTypeEnum construction_type;
+ int value;
+};
+
+namespace boost {
+namespace container {
+
+template<unsigned int AllocatorTag>
+struct constructible_with_allocator_prefix
+ < ::mark_on_scoped_allocation<ConstructiblePrefix, AllocatorTag> >
+ : ::boost::true_type
+{};
+
+template<unsigned int AllocatorTag>
+struct constructible_with_allocator_suffix
+ < ::mark_on_scoped_allocation<ConstructibleSuffix, AllocatorTag> >
+ : ::boost::true_type
+{};
+
+} //namespace container {
+} //namespace boost {
+
+
+int main()
+{
+ typedef test_allocator<tagged_integer<0>, 0> OuterAlloc;
+ typedef test_allocator<tagged_integer<0>, 10> Outer10IdAlloc;
+ typedef test_allocator<tagged_integer<9>, 0> Rebound9OuterAlloc;
+ typedef test_allocator<tagged_integer<1>, 1> InnerAlloc1;
+ typedef test_allocator<tagged_integer<2>, 2> InnerAlloc2;
+ typedef test_allocator<tagged_integer<1>, 11> Inner11IdAlloc1;
+ typedef test_allocator<tagged_integer<1>, 12> Inner12IdAlloc2;
+
+ typedef test_allocator<tagged_integer<0>, 0, false> OuterAllocFalsePropagate;
+ typedef test_allocator<tagged_integer<0>, 0, true> OuterAllocTruePropagate;
+ typedef test_allocator<tagged_integer<1>, 1, false> InnerAlloc1FalsePropagate;
+ typedef test_allocator<tagged_integer<1>, 1, true> InnerAlloc1TruePropagate;
+ typedef test_allocator<tagged_integer<2>, 2, false> InnerAlloc2FalsePropagate;
+ typedef test_allocator<tagged_integer<2>, 2, true> InnerAlloc2TruePropagate;
+
+ //
+ typedef scoped_allocator_adaptor< OuterAlloc > Scoped0Inner;
+ typedef scoped_allocator_adaptor< OuterAlloc
+ , InnerAlloc1 > Scoped1Inner;
+ typedef scoped_allocator_adaptor< OuterAlloc
+ , InnerAlloc1
+ , InnerAlloc2 > Scoped2Inner;
+ typedef scoped_allocator_adaptor
+ < scoped_allocator_adaptor
+ <Outer10IdAlloc>
+ > ScopedScoped0Inner;
+ typedef scoped_allocator_adaptor
+ < scoped_allocator_adaptor
+ <Outer10IdAlloc, Inner11IdAlloc1>
+ , InnerAlloc1
+ > ScopedScoped1Inner;
+ typedef scoped_allocator_adaptor
+ < scoped_allocator_adaptor
+ <Outer10IdAlloc, Inner11IdAlloc1, Inner12IdAlloc2>
+ , InnerAlloc1, InnerAlloc2
+ > ScopedScoped2Inner;
+ typedef scoped_allocator_adaptor< Rebound9OuterAlloc > Rebound9Scoped0Inner;
+ typedef scoped_allocator_adaptor< Rebound9OuterAlloc
+ , InnerAlloc1 > Rebound9Scoped1Inner;
+ typedef scoped_allocator_adaptor< Rebound9OuterAlloc
+ , InnerAlloc1
+ , InnerAlloc2 > Rebound9Scoped2Inner;
+
+ //outer_allocator_type
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< OuterAlloc
+ , Scoped0Inner::outer_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< OuterAlloc
+ , Scoped1Inner::outer_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< OuterAlloc
+ , Scoped2Inner::outer_allocator_type>::value ));
+ //value_type
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::value_type
+ , Scoped0Inner::value_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::value_type
+ , Scoped1Inner::value_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::value_type
+ , Scoped2Inner::value_type>::value ));
+ //size_type
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::size_type
+ , Scoped0Inner::size_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::size_type
+ , Scoped1Inner::size_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::size_type
+ , Scoped2Inner::size_type>::value ));
+
+ //difference_type
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::difference_type
+ , Scoped0Inner::difference_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::difference_type
+ , Scoped1Inner::difference_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::difference_type
+ , Scoped2Inner::difference_type>::value ));
+
+ //pointer
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::pointer
+ , Scoped0Inner::pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::pointer
+ , Scoped1Inner::pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::pointer
+ , Scoped2Inner::pointer>::value ));
+
+ //const_pointer
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_pointer
+ , Scoped0Inner::const_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_pointer
+ , Scoped1Inner::const_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_pointer
+ , Scoped2Inner::const_pointer>::value ));
+
+ //void_pointer
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::void_pointer
+ , Scoped0Inner::void_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::void_pointer
+ , Scoped1Inner::void_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::void_pointer
+ , Scoped2Inner::void_pointer>::value ));
+
+ //const_void_pointer
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_void_pointer
+ , Scoped0Inner::const_void_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_void_pointer
+ , Scoped1Inner::const_void_pointer>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< allocator_traits<OuterAlloc>::const_void_pointer
+ , Scoped2Inner::const_void_pointer>::value ));
+
+ //rebind
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same<Scoped0Inner::rebind< tagged_integer<9> >::other
+ , Rebound9Scoped0Inner >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same<Scoped1Inner::rebind< tagged_integer<9> >::other
+ , Rebound9Scoped1Inner >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same<Scoped2Inner::rebind< tagged_integer<9> >::other
+ , Rebound9Scoped2Inner >::value ));
+
+ //inner_allocator_type
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< Scoped0Inner
+ , Scoped0Inner::inner_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< scoped_allocator_adaptor<InnerAlloc1>
+ , Scoped1Inner::inner_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( boost::container::container_detail::is_same< scoped_allocator_adaptor<InnerAlloc1, InnerAlloc2>
+ , Scoped2Inner::inner_allocator_type>::value ));
+
+ {
+ //Propagation test
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate > Scoped0InnerF;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate > Scoped0InnerT;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1FalsePropagate > Scoped1InnerFF;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1TruePropagate > Scoped1InnerFT;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1FalsePropagate > Scoped1InnerTF;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1TruePropagate > Scoped1InnerTT;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1FalsePropagate
+ , InnerAlloc2FalsePropagate > Scoped2InnerFFF;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1FalsePropagate
+ , InnerAlloc2TruePropagate > Scoped2InnerFFT;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1TruePropagate
+ , InnerAlloc2FalsePropagate > Scoped2InnerFTF;
+ typedef scoped_allocator_adaptor< OuterAllocFalsePropagate
+ , InnerAlloc1TruePropagate
+ , InnerAlloc2TruePropagate > Scoped2InnerFTT;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1FalsePropagate
+ , InnerAlloc2FalsePropagate > Scoped2InnerTFF;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1FalsePropagate
+ , InnerAlloc2TruePropagate > Scoped2InnerTFT;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1TruePropagate
+ , InnerAlloc2FalsePropagate > Scoped2InnerTTF;
+ typedef scoped_allocator_adaptor< OuterAllocTruePropagate
+ , InnerAlloc1TruePropagate
+ , InnerAlloc2TruePropagate > Scoped2InnerTTT;
+
+ //propagate_on_container_copy_assignment
+ //0 inner
+ BOOST_STATIC_ASSERT(( !Scoped0InnerF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped0InnerT::propagate_on_container_copy_assignment::value ));
+ //1 inner
+ BOOST_STATIC_ASSERT(( !Scoped1InnerFF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerFT::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTT::propagate_on_container_copy_assignment::value ));
+ //2 inner
+ BOOST_STATIC_ASSERT(( !Scoped2InnerFFF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFFT::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTT::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFT::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTF::propagate_on_container_copy_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTT::propagate_on_container_copy_assignment::value ));
+
+ //propagate_on_container_move_assignment
+ //0 inner
+ BOOST_STATIC_ASSERT(( !Scoped0InnerF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped0InnerT::propagate_on_container_move_assignment::value ));
+ //1 inner
+ BOOST_STATIC_ASSERT(( !Scoped1InnerFF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerFT::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTT::propagate_on_container_move_assignment::value ));
+ //2 inner
+ BOOST_STATIC_ASSERT(( !Scoped2InnerFFF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFFT::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTT::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFT::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTF::propagate_on_container_move_assignment::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTT::propagate_on_container_move_assignment::value ));
+
+ //propagate_on_container_swap
+ //0 inner
+ BOOST_STATIC_ASSERT(( !Scoped0InnerF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped0InnerT::propagate_on_container_swap::value ));
+ //1 inner
+ BOOST_STATIC_ASSERT(( !Scoped1InnerFF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerFT::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped1InnerTT::propagate_on_container_swap::value ));
+ //2 inner
+ BOOST_STATIC_ASSERT(( !Scoped2InnerFFF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFFT::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerFTT::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTFT::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTF::propagate_on_container_swap::value ));
+ BOOST_STATIC_ASSERT(( Scoped2InnerTTT::propagate_on_container_swap::value ));
+ }
+
+ //Default constructor
+ {
+ Scoped0Inner s0i;
+ Scoped1Inner s1i;
+ }
+
+ //inner_allocator()
+ {
+ Scoped0Inner s0i;
+ Scoped1Inner s1i;
+ Scoped2Inner s2i;
+ const Scoped0Inner const_s0i;
+ const Scoped1Inner const_s1i;
+ const Scoped2Inner const_s2i;
+
+ Scoped0Inner::inner_allocator_type &s0i_inner = s0i.inner_allocator();
+ (void)s0i_inner;
+ const Scoped0Inner::inner_allocator_type &const_s0i_inner = const_s0i.inner_allocator();
+ (void)const_s0i_inner;
+ Scoped1Inner::inner_allocator_type &s1i_inner = s1i.inner_allocator();
+ (void)s1i_inner;
+ const Scoped1Inner::inner_allocator_type &const_s1i_inner = const_s1i.inner_allocator();
+ (void)const_s1i_inner;
+ Scoped2Inner::inner_allocator_type &s2i_inner = s2i.inner_allocator();
+ (void)s2i_inner;
+ const Scoped2Inner::inner_allocator_type &const_s2i_inner = const_s2i.inner_allocator();
+ (void)const_s2i_inner;
+ }
+
+ //operator==/!=
+ {
+ const Scoped0Inner const_s0i;
+ const Rebound9Scoped0Inner const_rs0i;
+ if(!(const_s0i == const_s0i) ||
+ !(const_rs0i == const_s0i)){
+ return 1;
+ }
+ if( const_s0i != const_s0i ||
+ const_s0i != const_rs0i ){
+ return 1;
+ }
+
+ const Scoped1Inner const_s1i;
+ const Rebound9Scoped1Inner const_rs1i;
+ if(!(const_s1i == const_s1i) ||
+ !(const_rs1i == const_s1i)){
+ return 1;
+ }
+ if( const_s1i != const_s1i ||
+ const_s1i != const_rs1i ){
+ return 1;
+ }
+ const Scoped2Inner const_s2i;
+ const Rebound9Scoped2Inner const_rs2i;
+ if(!(const_s2i == const_s2i) ||
+ !(const_s2i == const_rs2i) ){
+ return 1;
+ }
+ if( const_s2i != const_s2i ||
+ const_s2i != const_rs2i ){
+ return 1;
+ }
+ }
+
+ //outer_allocator()
+ {
+ Scoped0Inner s0i;
+ Scoped1Inner s1i;
+ Scoped2Inner s2i;
+ const Scoped0Inner const_s0i;
+ const Scoped1Inner const_s1i;
+ const Scoped2Inner const_s2i;
+
+ Scoped0Inner::outer_allocator_type &s0i_inner = s0i.outer_allocator();
+ (void)s0i_inner;
+ const Scoped0Inner::outer_allocator_type &const_s0i_inner = const_s0i.outer_allocator();
+ (void)const_s0i_inner;
+ Scoped1Inner::outer_allocator_type &s1i_inner = s1i.outer_allocator();
+ (void)s1i_inner;
+ const Scoped1Inner::outer_allocator_type &const_s1i_inner = const_s1i.outer_allocator();
+ (void)const_s1i_inner;
+ Scoped2Inner::outer_allocator_type &s2i_inner = s2i.outer_allocator();
+ (void)s2i_inner;
+ const Scoped2Inner::outer_allocator_type &const_s2i_inner = const_s2i.outer_allocator();
+ (void)const_s2i_inner;
+ }
+
+ //max_size()
+ {
+ const Scoped0Inner const_s0i;
+ const Scoped1Inner const_s1i;
+ const Scoped2Inner const_s2i;
+ const OuterAlloc const_oa;
+ const InnerAlloc1 const_ia1;
+ const InnerAlloc2 const_ia2;
+
+ if(const_s0i.max_size() != const_oa.max_size()){
+ return 1;
+ }
+
+ if(const_s1i.max_size() != const_oa.max_size()){
+ return 1;
+ }
+
+ if(const_s2i.max_size() != const_oa.max_size()){
+ return 1;
+ }
+
+ if(const_s1i.inner_allocator().max_size() != const_ia1.max_size()){
+ return 1;
+ }
+
+ if(const_s2i.inner_allocator().inner_allocator().max_size() != const_ia2.max_size()){
+ return 1;
+ }
+ }
+ //Copy and move operations
+ {
+ //Construction
+ {
+ Scoped0Inner s0i_a, s0i_b(s0i_a), s0i_c(::boost::move(s0i_b));
+ Scoped1Inner s1i_a, s1i_b(s1i_a), s1i_c(::boost::move(s1i_b));
+ Scoped2Inner s2i_a, s2i_b(s2i_a), s2i_c(::boost::move(s2i_b));
+ }
+ //Assignment
+ {
+ Scoped0Inner s0i_a, s0i_b;
+ s0i_a = s0i_b;
+ s0i_a = ::boost::move(s0i_b);
+ Scoped1Inner s1i_a, s1i_b;
+ s1i_a = s1i_b;
+ s1i_a = ::boost::move(s1i_b);
+ Scoped2Inner s2i_a, s2i_b;
+ s2i_a = s2i_b;
+ s2i_a = ::boost::move(s2i_b);
+ }
+
+ OuterAlloc oa;
+ InnerAlloc1 ia1;
+ InnerAlloc2 ia2;
+ Rebound9OuterAlloc roa;
+ Rebound9Scoped0Inner rs0i;
+ Rebound9Scoped1Inner rs1i;
+ Rebound9Scoped2Inner rs2i;
+
+ //Copy from outer
+ {
+ Scoped0Inner s0i(oa);
+ Scoped1Inner s1i(oa, ia1);
+ Scoped2Inner s2i(oa, ia1, ia2);
+ }
+ //Move from outer
+ {
+ Scoped0Inner s0i(::boost::move(oa));
+ Scoped1Inner s1i(::boost::move(oa), ia1);
+ Scoped2Inner s2i(::boost::move(oa), ia1, ia2);
+ }
+ //Copy from rebound outer
+ {
+ Scoped0Inner s0i(roa);
+ Scoped1Inner s1i(roa, ia1);
+ Scoped2Inner s2i(roa, ia1, ia2);
+ }
+ //Move from rebound outer
+ {
+ Scoped0Inner s0i(::boost::move(roa));
+ Scoped1Inner s1i(::boost::move(roa), ia1);
+ Scoped2Inner s2i(::boost::move(roa), ia1, ia2);
+ }
+ //Copy from rebound scoped
+ {
+ Scoped0Inner s0i(rs0i);
+ Scoped1Inner s1i(rs1i);
+ Scoped2Inner s2i(rs2i);
+ }
+ //Move from rebound scoped
+ {
+ Scoped0Inner s0i(::boost::move(rs0i));
+ Scoped1Inner s1i(::boost::move(rs1i));
+ Scoped2Inner s2i(::boost::move(rs2i));
+ }
+ }
+
+ {
+ vector<int, scoped_allocator_adaptor< test_allocator<int, 0> > > dummy;
+ dummy.push_back(0);
+ }
+
+ //destroy()
+ {
+ {
+ Scoped0Inner s0i;
+ mark_on_destructor mod;
+ s0i.destroy(&mod);
+ if(!mod.destroyed){
+ return 1;
+ }
+ }
+
+ {
+ Scoped1Inner s1i;
+ mark_on_destructor mod;
+ s1i.destroy(&mod);
+ if(!mod.destroyed){
+ return 1;
+ }
+ }
+ {
+ Scoped2Inner s2i;
+ mark_on_destructor mod;
+ s2i.destroy(&mod);
+ if(!mod.destroyed){
+ return 1;
+ }
+ }
+ }
+
+ //construct
+ {
+
+ BOOST_STATIC_ASSERT(( !boost::container::uses_allocator
+ < ::mark_on_scoped_allocation<NotUsesAllocator, 0>
+ , test_allocator<float, 0>
+ >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::uses_allocator
+ < ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
+ , test_allocator<float, 0>
+ >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::uses_allocator
+ < ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
+ , test_allocator<float, 0>
+ >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
+ < ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
+ BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_suffix
+ < ::mark_on_scoped_allocation<ConstructibleSuffix, 0> >::value ));
+
+ ////////////////////////////////////////////////////////////
+ //First check scoped allocator with just OuterAlloc.
+ //In this case OuterAlloc (test_allocator with tag 0) should be
+ //used to construct types.
+ ////////////////////////////////////////////////////////////
+ {
+ Scoped0Inner s0i;
+ //Check construction with 0 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+
+ //Check construction with 1 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy, 1);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 1){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy, 2);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 2){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s0i.construct(&dummy, 3);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 3){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ }
+ ////////////////////////////////////////////////////////////
+ //Then check scoped allocator with OuterAlloc and InnerAlloc.
+ //In this case InnerAlloc (test_allocator with tag 1) should be
+ //used to construct types.
+ ////////////////////////////////////////////////////////////
+ {
+ Scoped1Inner s1i;
+ //Check construction with 0 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+
+ //Check construction with 1 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy, 1);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 1){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy, 2);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 2){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 1> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ s1i.construct(&dummy, 3);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 3){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+ //Now test recursive OuterAllocator types (OuterAllocator is an scoped_allocator)
+ //////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////
+ //First check scoped allocator with just OuterAlloc.
+ //In this case OuterAlloc (test_allocator with tag 0) should be
+ //used to construct types.
+ ////////////////////////////////////////////////////////////
+ {
+ //Check outer_allocator_type is scoped
+ BOOST_STATIC_ASSERT(( boost::container::is_scoped_allocator
+ <ScopedScoped0Inner::outer_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < boost::container::outermost_allocator<ScopedScoped0Inner>::type
+ , Outer10IdAlloc
+ >::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < ScopedScoped0Inner::outer_allocator_type
+ , scoped_allocator_adaptor<Outer10IdAlloc>
+ >::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < scoped_allocator_adaptor<Outer10IdAlloc>::outer_allocator_type
+ , Outer10IdAlloc
+ >::value ));
+ ScopedScoped0Inner ssro0i;
+ Outer10IdAlloc & val = boost::container::outermost_allocator<ScopedScoped0Inner>::get(ssro0i);
+ (void)val;
+ //Check construction with 0 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+
+ //Check construction with 1 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy, 1);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 1){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy, 2);
+ if(dummy.construction_type != ConstructibleSuffix ||
+ dummy.value != 2){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro0i.construct(&dummy, 3);
+ if(dummy.construction_type != ConstructiblePrefix ||
+ dummy.value != 3){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ }
+ ////////////////////////////////////////////////////////////
+ //Then check scoped allocator with OuterAlloc and InnerAlloc.
+ //In this case inner_allocator_type is not convertible to
+ //::mark_on_scoped_allocation<XXX, 10> so uses_allocator
+ //should be false on all tests.
+ ////////////////////////////////////////////////////////////
+ {
+ //Check outer_allocator_type is scoped
+ BOOST_STATIC_ASSERT(( boost::container::is_scoped_allocator
+ <ScopedScoped1Inner::outer_allocator_type>::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < boost::container::outermost_allocator<ScopedScoped1Inner>::type
+ , Outer10IdAlloc
+ >::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < ScopedScoped1Inner::outer_allocator_type
+ , scoped_allocator_adaptor<Outer10IdAlloc, Inner11IdAlloc1>
+ >::value ));
+ BOOST_STATIC_ASSERT(( ::boost::container::container_detail::is_same
+ < scoped_allocator_adaptor<Outer10IdAlloc, Inner11IdAlloc1>::outer_allocator_type
+ , Outer10IdAlloc
+ >::value ));
+ BOOST_STATIC_ASSERT(( !
+ ::boost::container::uses_allocator
+ < ::mark_on_scoped_allocation<ConstructibleSuffix, 10>
+ , ScopedScoped1Inner::inner_allocator_type::outer_allocator_type
+ >::value ));
+ ScopedScoped1Inner ssro1i;
+ Outer10IdAlloc & val = boost::container::outermost_allocator<ScopedScoped1Inner>::get(ssro1i);
+ (void)val;
+
+ //Check construction with 0 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 0){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+
+ //Check construction with 1 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy, 1);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 1){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy, 2);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 2){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 10> MarkType;
+ MarkType dummy;
+ dummy.~MarkType();
+ ssro1i.construct(&dummy, 3);
+ if(dummy.construction_type != NotUsesAllocator ||
+ dummy.value != 3){
+ dummy.~MarkType();
+ return 1;
+ }
+ dummy.~MarkType();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////
+ //Now check propagation to pair
+ ////////////////////////////////////////////////////////////
+ //First check scoped allocator with just OuterAlloc.
+ //In this case OuterAlloc (test_allocator with tag 0) should be
+ //used to construct types.
+ ////////////////////////////////////////////////////////////
+ {
+ using boost::container::container_detail::pair;
+ typedef test_allocator< pair< tagged_integer<0>
+ , tagged_integer<0> >, 0> OuterPairAlloc;
+ typedef test_allocator< pair< tagged_integer<1>
+ , tagged_integer<1> >, 1> InnerPairAlloc1;
+ typedef test_allocator< pair< tagged_integer<2>
+ , tagged_integer<2> >, 2> InnerPairAlloc2;
+ //
+ typedef scoped_allocator_adaptor < OuterPairAlloc > ScopedPair0Inner;
+ typedef scoped_allocator_adaptor < OuterPairAlloc
+ , InnerPairAlloc1 > ScopedPair1Inner;
+ typedef scoped_allocator_adaptor < OuterPairAlloc
+ , InnerPairAlloc1
+ , InnerPairAlloc2 > ScopedPair2Inner;
+
+ ScopedPair0Inner s0i;
+ //Check construction with 0 user arguments
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy);
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 0 ||
+ dummy.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy);
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 0 ||
+ dummy.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy);
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 0 ||
+ dummy.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+
+ //Check construction with 1 user arguments for each pair
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, 1, 1);
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, 1, 1);
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, 2, 2);
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 2 ||
+ dummy.second.value != 2 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ //Check construction with pair copy construction
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 0 ||
+ dummy.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2(1, 1);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2(2, 2);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 2 ||
+ dummy.second.value != 2 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ //Check construction with pair move construction
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2(3, 3);
+ dummy2.first.construction_type = dummy2.second.construction_type = ConstructibleSuffix;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 3 ||
+ dummy.second.value != 3 ||
+ dummy2.first.construction_type != NotUsesAllocator ||
+ dummy2.second.construction_type != NotUsesAllocator ||
+ dummy2.first.value != 0 ||
+ dummy2.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2(1, 1);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ||
+ dummy2.first.construction_type != ConstructibleSuffix ||
+ dummy2.second.construction_type != ConstructibleSuffix ||
+ dummy2.first.value != 0 ||
+ dummy2.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy, dummy2(2, 2);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 2 ||
+ dummy.second.value != 2 ||
+ dummy2.first.construction_type != ConstructiblePrefix ||
+ dummy2.second.construction_type != ConstructiblePrefix ||
+ dummy2.first.value != 0 ||
+ dummy2.second.value != 0 ){
+ dummy2.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ //Check construction with related pair copy construction
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2;
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 0 ||
+ dummy.second.value != 0 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2(1, 1);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2(2, 2);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, dummy2);
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 2 ||
+ dummy.second.value != 2 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ //Check construction with related pair move construction
+ {
+ typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2(3, 3);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != NotUsesAllocator ||
+ dummy.second.construction_type != NotUsesAllocator ||
+ dummy.first.value != 3 ||
+ dummy.second.value != 3 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructibleSuffix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2(1, 1);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != ConstructibleSuffix ||
+ dummy.second.construction_type != ConstructibleSuffix ||
+ dummy.first.value != 1 ||
+ dummy.second.value != 1 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ {
+ typedef ::mark_on_scoped_allocation<ConstructiblePrefix, 0> MarkType;
+ typedef pair<MarkType, MarkType> MarkTypePair;
+ MarkTypePair dummy;
+ pair<int, int> dummy2(2, 2);
+ dummy.~MarkTypePair();
+ s0i.construct(&dummy, ::boost::move(dummy2));
+ if(dummy.first.construction_type != ConstructiblePrefix ||
+ dummy.second.construction_type != ConstructiblePrefix ||
+ dummy.first.value != 2 ||
+ dummy.second.value != 2 ){
+ dummy.~MarkTypePair();
+ return 1;
+ }
+ dummy.~MarkTypePair();
+ }
+ }
+ }
+
+ return 0;
+}
+#include <boost/container/detail/config_end.hpp>
Modified: trunk/libs/container/test/set_test.hpp
==============================================================================
--- trunk/libs/container/test/set_test.hpp (original)
+++ trunk/libs/container/test/set_test.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/slist_test.cpp
==============================================================================
--- trunk/libs/container/test/slist_test.cpp (original)
+++ trunk/libs/container/test/slist_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/stable_vector_test.cpp
==============================================================================
--- trunk/libs/container/test/stable_vector_test.cpp (original)
+++ trunk/libs/container/test/stable_vector_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/string_test.cpp
==============================================================================
--- trunk/libs/container/test/string_test.cpp (original)
+++ trunk/libs/container/test/string_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/tree_test.cpp
==============================================================================
--- trunk/libs/container/test/tree_test.cpp (original)
+++ trunk/libs/container/test/tree_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
@@ -201,8 +201,10 @@
{
//Now test move semantics
C original;
+ original.emplace();
C move_ctor(boost::move(original));
C move_assign;
+ move_assign.emplace();
move_assign = boost::move(move_ctor);
move_assign.swap(original);
}
Modified: trunk/libs/container/test/util.hpp
==============================================================================
--- trunk/libs/container/test/util.hpp (original)
+++ trunk/libs/container/test/util.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
Modified: trunk/libs/container/test/vector_test.cpp
==============================================================================
--- trunk/libs/container/test/vector_test.cpp (original)
+++ trunk/libs/container/test/vector_test.cpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
@@ -95,6 +95,26 @@
int main()
{
+ const std::size_t positions_length = 10;
+ std::size_t positions[positions_length];
+ vector<int> vector_int;
+ vector<int> vector_int2(positions_length);
+ for(std::size_t i = 0; i != positions_length; ++i){
+ positions[i] = 0u;
+ }
+ for(std::size_t i = 0, max = vector_int2.size(); i != max; ++i){
+ vector_int2[i] = i;
+ }
+
+ vector_int.insert(vector_int.begin(), 999);
+
+ vector_int.insert_at_ordered_positions(positions, positions_length, vector_int2.end());
+
+ for(std::size_t i = 0, max = vector_int.size(); i != max; ++i){
+ std::cout << vector_int[i] << std::endl;
+ }
+ return 0;
+/*
recursive_vector_test();
{
//Now test move semantics
@@ -134,7 +154,8 @@
if(!boost::container::test::test_propagate_allocator<vector>())
return 1;
-
+
return 0;
+ */
}
#include <boost/container/detail/config_end.hpp>
Modified: trunk/libs/container/test/vector_test.hpp
==============================================================================
--- trunk/libs/container/test/vector_test.hpp (original)
+++ trunk/libs/container/test/vector_test.hpp 2012-03-22 14:48:57 EDT (Thu, 22 Mar 2012)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. 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)
//
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