mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 05:54:28 +02:00
Support types with std::allocator_arg_at with boost::container::scoped_allocator_adaptor
This commit is contained in:
@@ -385,6 +385,9 @@ struct allocator_traits
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// priv_construct
|
||||||
|
//////////////////
|
||||||
#define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \
|
#define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \
|
||||||
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||||
static void priv_construct(container_detail::false_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
static void priv_construct(container_detail::false_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
@@ -398,7 +401,14 @@ struct allocator_traits
|
|||||||
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||||
static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
{ (priv_construct_dispatch_next)(container_detail::false_type(), a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
{ (priv_construct_dispatch_next)(container_detail::false_type(), a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
||||||
\
|
//
|
||||||
|
BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL)
|
||||||
|
#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// priv_construct_dispatch_next
|
||||||
|
/////////////////////////////////
|
||||||
|
#define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL(N) \
|
||||||
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||||
static void priv_construct_dispatch_next(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
static void priv_construct_dispatch_next(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
{ a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\
|
{ a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\
|
||||||
@@ -407,8 +417,9 @@ struct allocator_traits
|
|||||||
static void priv_construct_dispatch_next(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
static void priv_construct_dispatch_next(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
{ ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\
|
{ ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\
|
||||||
//
|
//
|
||||||
BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL)
|
BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL)
|
||||||
#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL
|
#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL
|
||||||
|
|
||||||
#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@@ -40,6 +40,13 @@ struct bool_ : integral_constant<bool, C_>
|
|||||||
operator bool() const { return bool_::value; }
|
operator bool() const { return bool_::value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template< unsigned V_ >
|
||||||
|
struct unsigned_ : integral_constant<unsigned, V_>
|
||||||
|
{
|
||||||
|
static const unsigned value = V_;
|
||||||
|
operator unsigned() const { return unsigned_::value; }
|
||||||
|
};
|
||||||
|
|
||||||
typedef bool_<true> true_;
|
typedef bool_<true> true_;
|
||||||
typedef bool_<false> false_;
|
typedef bool_<false> false_;
|
||||||
|
|
||||||
|
33
include/boost/container/detail/std_allocator_arg.hpp
Normal file
33
include/boost/container/detail/std_allocator_arg.hpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef BOOST_CONTAINER_DETAIL_ALLOCATOR_ARG_HPP
|
||||||
|
#define BOOST_CONTAINER_DETAIL_ALLOCATOR_ARG_HPP
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// (C) Copyright Ion Gaztanaga 2014-2015. 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.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/container/detail/std_fwd.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace container {
|
||||||
|
|
||||||
|
template<int Dummy = 0>
|
||||||
|
struct alloc_arg
|
||||||
|
{
|
||||||
|
static const std::allocator_arg_t &get() { return *palloc_arg; }
|
||||||
|
static std::allocator_arg_t *palloc_arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int Dummy>
|
||||||
|
std::allocator_arg_t *alloc_arg<Dummy>::palloc_arg;
|
||||||
|
|
||||||
|
}} //namespace boost { namespace container {
|
||||||
|
|
||||||
|
#endif //BOOST_CONTAINER_DETAIL_ALLOCATOR_ARG_HPP
|
@@ -52,6 +52,8 @@ struct random_access_iterator_tag;
|
|||||||
template<class Container>
|
template<class Container>
|
||||||
class insert_iterator;
|
class insert_iterator;
|
||||||
|
|
||||||
|
struct allocator_arg_t;
|
||||||
|
|
||||||
BOOST_CONTAINER_STD_NS_END
|
BOOST_CONTAINER_STD_NS_END
|
||||||
|
|
||||||
#ifdef BOOST_CONTAINER_CLANG_INLINE_STD_NS
|
#ifdef BOOST_CONTAINER_CLANG_INLINE_STD_NS
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include <boost/container/detail/pair.hpp>
|
#include <boost/container/detail/pair.hpp>
|
||||||
#include <boost/container/detail/type_traits.hpp>
|
#include <boost/container/detail/type_traits.hpp>
|
||||||
|
#include <boost/container/detail/std_allocator_arg.hpp>
|
||||||
|
|
||||||
#include <boost/move/adl_move_swap.hpp>
|
#include <boost/move/adl_move_swap.hpp>
|
||||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
@@ -135,6 +136,10 @@ template <class T>
|
|||||||
struct constructible_with_allocator_prefix
|
struct constructible_with_allocator_prefix
|
||||||
{ static const bool value = false; };
|
{ static const bool value = false; };
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct constructible_with_std_allocator_prefix
|
||||||
|
{ static const bool value = false; };
|
||||||
|
|
||||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||||
|
|
||||||
namespace container_detail {
|
namespace container_detail {
|
||||||
@@ -269,7 +274,7 @@ namespace container_detail {
|
|||||||
|
|
||||||
//With variadic templates, we need a single class to implement the trait
|
//With variadic templates, we need a single class to implement the trait
|
||||||
template<class T, class ...Args>
|
template<class T, class ...Args>
|
||||||
struct is_constructible_impl
|
struct is_constructible
|
||||||
{
|
{
|
||||||
typedef char yes_type;
|
typedef char yes_type;
|
||||||
struct no_type
|
struct no_type
|
||||||
@@ -287,16 +292,16 @@ namespace container_detail {
|
|||||||
static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
|
static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class ...Args>
|
|
||||||
struct is_constructible
|
|
||||||
: is_constructible_impl<T, Args...>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class T, class InnerAlloc, class ...Args>
|
template <class T, class InnerAlloc, class ...Args>
|
||||||
struct is_constructible_with_allocator_prefix
|
struct is_constructible_with_allocator_prefix
|
||||||
: is_constructible<T, allocator_arg_t, InnerAlloc, Args...>
|
: is_constructible<T, allocator_arg_t, InnerAlloc, Args...>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
template <class T, class InnerAlloc, class ...Args>
|
||||||
|
struct is_constructible_with_std_allocator_prefix
|
||||||
|
: is_constructible<T, const std::allocator_arg_t&, InnerAlloc, Args...>
|
||||||
|
{};
|
||||||
|
|
||||||
#else // #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#else // #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
//Without advanced SFINAE expressions, we can't use is_constructible
|
//Without advanced SFINAE expressions, we can't use is_constructible
|
||||||
@@ -304,24 +309,34 @@ namespace container_detail {
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
template < class T, class InnerAlloc, class ...Args>
|
template <class T, class InnerAlloc, class ...Args>
|
||||||
struct is_constructible_with_allocator_prefix
|
struct is_constructible_with_allocator_prefix
|
||||||
: constructible_with_allocator_prefix<T>
|
: constructible_with_allocator_prefix<T>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template < class T, class InnerAlloc, class ...Args>
|
template <class T, class InnerAlloc, class ...Args>
|
||||||
|
struct is_constructible_with_std_allocator_prefix
|
||||||
|
: constructible_with_std_allocator_prefix<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <class T, class InnerAlloc, class ...Args>
|
||||||
struct is_constructible_with_allocator_suffix
|
struct is_constructible_with_allocator_suffix
|
||||||
: constructible_with_allocator_suffix<T>
|
: constructible_with_allocator_suffix<T>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
template < class T, class InnerAlloc, BOOST_MOVE_CLASSDFLT9>
|
template <class T, class InnerAlloc, BOOST_MOVE_CLASSDFLT9>
|
||||||
struct is_constructible_with_allocator_prefix
|
struct is_constructible_with_allocator_prefix
|
||||||
: constructible_with_allocator_prefix<T>
|
: constructible_with_allocator_prefix<T>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template < class T, class InnerAlloc, BOOST_MOVE_CLASSDFLT9>
|
template <class T, class InnerAlloc, BOOST_MOVE_CLASSDFLT9>
|
||||||
|
struct is_constructible_with_std_allocator_prefix
|
||||||
|
: constructible_with_std_allocator_prefix<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <class T, class InnerAlloc, BOOST_MOVE_CLASSDFLT9>
|
||||||
struct is_constructible_with_allocator_suffix
|
struct is_constructible_with_allocator_suffix
|
||||||
: constructible_with_allocator_suffix<T>
|
: constructible_with_allocator_suffix<T>
|
||||||
{};
|
{};
|
||||||
@@ -332,27 +347,42 @@ namespace container_detail {
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
|
// allocator_arg_t
|
||||||
template < typename OutermostAlloc
|
template < typename OutermostAlloc
|
||||||
, typename InnerAlloc
|
, typename InnerAlloc
|
||||||
, typename T
|
, typename T
|
||||||
, class ...Args
|
, class ...Args
|
||||||
>
|
>
|
||||||
inline void dispatch_allocator_prefix_suffix
|
inline void dispatch_allocator_prefix_suffix
|
||||||
( true_type use_alloc_prefix, OutermostAlloc& outermost_alloc
|
( unsigned_<1> use_alloc_prefix, OutermostAlloc& outermost_alloc
|
||||||
, InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args)
|
, InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args)
|
||||||
{
|
{
|
||||||
(void)use_alloc_prefix;
|
(void)use_alloc_prefix;
|
||||||
allocator_traits<OutermostAlloc>::construct
|
allocator_traits<OutermostAlloc>::construct
|
||||||
( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward<Args>(args)...);
|
( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
// std::allocator_arg_t
|
||||||
template < typename OutermostAlloc
|
template < typename OutermostAlloc
|
||||||
, typename InnerAlloc
|
, typename InnerAlloc
|
||||||
, typename T
|
, typename T
|
||||||
, class ...Args
|
, class ...Args
|
||||||
>
|
>
|
||||||
inline void dispatch_allocator_prefix_suffix
|
inline void dispatch_allocator_prefix_suffix
|
||||||
( false_type use_alloc_prefix, OutermostAlloc& outermost_alloc
|
( unsigned_<2> use_alloc_prefix, OutermostAlloc& outermost_alloc
|
||||||
|
, InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
|
||||||
|
{
|
||||||
|
(void)use_alloc_prefix;
|
||||||
|
allocator_traits<OutermostAlloc>::construct
|
||||||
|
( outermost_alloc, p, alloc_arg<>::get(), inner_alloc, ::boost::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
// allocator suffix
|
||||||
|
template < typename OutermostAlloc
|
||||||
|
, typename InnerAlloc
|
||||||
|
, typename T
|
||||||
|
, class ...Args
|
||||||
|
>
|
||||||
|
inline void dispatch_allocator_prefix_suffix
|
||||||
|
( unsigned_<0> use_alloc_prefix, OutermostAlloc& outermost_alloc
|
||||||
, InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
|
, InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
|
||||||
{
|
{
|
||||||
(void)use_alloc_prefix;
|
(void)use_alloc_prefix;
|
||||||
@@ -373,7 +403,8 @@ inline void dispatch_uses_allocator
|
|||||||
//BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value ||
|
//BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value ||
|
||||||
// is_constructible_with_allocator_suffix<T, InnerAlloc, Args...>::value ));
|
// is_constructible_with_allocator_suffix<T, InnerAlloc, Args...>::value ));
|
||||||
dispatch_allocator_prefix_suffix
|
dispatch_allocator_prefix_suffix
|
||||||
( bool_<is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value >()
|
( unsigned_< is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value ? 1u :
|
||||||
|
(is_constructible_with_std_allocator_prefix<T, InnerAlloc, Args...>::value ? 2u : 0u) >()
|
||||||
, outermost_alloc, inner_alloc, p, ::boost::forward<Args>(args)...);
|
, outermost_alloc, inner_alloc, p, ::boost::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +429,7 @@ inline void dispatch_uses_allocator
|
|||||||
template < typename OutermostAlloc, typename InnerAlloc, typename T\
|
template < typename OutermostAlloc, typename InnerAlloc, typename T\
|
||||||
BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
|
BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
|
||||||
inline void dispatch_allocator_prefix_suffix\
|
inline void dispatch_allocator_prefix_suffix\
|
||||||
(true_type use_alloc_prefix, OutermostAlloc& outermost_alloc,\
|
(unsigned_<1u> use_alloc_prefix, OutermostAlloc& outermost_alloc,\
|
||||||
InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
{\
|
{\
|
||||||
(void)use_alloc_prefix,\
|
(void)use_alloc_prefix,\
|
||||||
@@ -406,10 +437,21 @@ inline void dispatch_allocator_prefix_suffix\
|
|||||||
(outermost_alloc, p, allocator_arg, inner_alloc BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
(outermost_alloc, p, allocator_arg, inner_alloc BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
template < typename OutermostAlloc, typename InnerAlloc, typename T\
|
||||||
|
BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
|
||||||
|
inline void dispatch_allocator_prefix_suffix\
|
||||||
|
(unsigned_<2u> use_alloc_prefix, OutermostAlloc& outermost_alloc,\
|
||||||
|
InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
|
{\
|
||||||
|
(void)use_alloc_prefix,\
|
||||||
|
allocator_traits<OutermostAlloc>::construct\
|
||||||
|
(outermost_alloc, p, alloc_arg<>::get(), inner_alloc BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||||
|
}\
|
||||||
|
\
|
||||||
template < typename OutermostAlloc, typename InnerAlloc, typename T\
|
template < typename OutermostAlloc, typename InnerAlloc, typename T\
|
||||||
BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||||
inline void dispatch_allocator_prefix_suffix\
|
inline void dispatch_allocator_prefix_suffix\
|
||||||
(false_type use_alloc_prefix, OutermostAlloc& outermost_alloc,\
|
(unsigned_<0u> use_alloc_prefix, OutermostAlloc& outermost_alloc,\
|
||||||
InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||||
{\
|
{\
|
||||||
(void)use_alloc_prefix;\
|
(void)use_alloc_prefix;\
|
||||||
@@ -425,8 +467,8 @@ inline void dispatch_uses_allocator\
|
|||||||
{\
|
{\
|
||||||
(void)uses_allocator;\
|
(void)uses_allocator;\
|
||||||
dispatch_allocator_prefix_suffix\
|
dispatch_allocator_prefix_suffix\
|
||||||
(bool_< is_constructible_with_allocator_prefix\
|
( unsigned_< is_constructible_with_allocator_prefix<T, InnerAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N>::value ? 1u :\
|
||||||
< T, InnerAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N>::value>()\
|
(is_constructible_with_std_allocator_prefix<T, InnerAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N>::value ? 2u : 0u) >()\
|
||||||
, outermost_alloc, inner_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
, outermost_alloc, inner_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <boost/container/detail/config_begin.hpp>
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
#include <boost/container/detail/workaround.hpp>
|
#include <boost/container/detail/workaround.hpp>
|
||||||
|
#include <boost/container/detail/std_fwd.hpp>
|
||||||
|
|
||||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
#include <boost/move/detail/fwd_macros.hpp>
|
#include <boost/move/detail/fwd_macros.hpp>
|
||||||
@@ -73,6 +74,9 @@ struct constructible_with_allocator_suffix;
|
|||||||
template <class T>
|
template <class T>
|
||||||
struct constructible_with_allocator_prefix;
|
struct constructible_with_allocator_prefix;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct constructible_with_std_allocator_prefix;
|
||||||
|
|
||||||
template <typename T, typename Allocator>
|
template <typename T, typename Allocator>
|
||||||
struct uses_allocator;
|
struct uses_allocator;
|
||||||
|
|
||||||
|
@@ -279,10 +279,10 @@
|
|||||||
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\std_fwd.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\std_allocator_arg.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\interprocess\detail\std_fwd.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\std_fwd.hpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\swap.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\swap.hpp">
|
||||||
|
@@ -9,11 +9,15 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
#include <boost/container/detail/config_begin.hpp>
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
#include <boost/container/scoped_allocator_fwd.hpp>
|
#include <boost/container/scoped_allocator_fwd.hpp>
|
||||||
#include <cstddef>
|
|
||||||
|
// container/detail
|
||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
|
// move
|
||||||
#include <boost/move/utility_core.hpp>
|
#include <boost/move/utility_core.hpp>
|
||||||
#include <boost/move/adl_move_swap.hpp>
|
#include <boost/move/adl_move_swap.hpp>
|
||||||
|
// std
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
using namespace boost::container;
|
using namespace boost::container;
|
||||||
|
|
||||||
@@ -113,6 +117,7 @@ struct mark_on_destructor
|
|||||||
enum ConstructionTypeEnum
|
enum ConstructionTypeEnum
|
||||||
{
|
{
|
||||||
ConstructiblePrefix,
|
ConstructiblePrefix,
|
||||||
|
ConstructibleStdPrefix,
|
||||||
ConstructibleSuffix,
|
ConstructibleSuffix,
|
||||||
NotUsesAllocator
|
NotUsesAllocator
|
||||||
};
|
};
|
||||||
@@ -133,6 +138,8 @@ struct uses_allocator_base<ConstructibleSuffix, AllocatorTag>
|
|||||||
typedef allocator_type allocator_constructor_type;
|
typedef allocator_type allocator_constructor_type;
|
||||||
struct nat{};
|
struct nat{};
|
||||||
typedef nat allocator_arg_type;
|
typedef nat allocator_arg_type;
|
||||||
|
struct nat2{};
|
||||||
|
typedef nat2 std_allocator_arg_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<unsigned int AllocatorTag>
|
template<unsigned int AllocatorTag>
|
||||||
@@ -141,6 +148,18 @@ struct uses_allocator_base<ConstructiblePrefix, AllocatorTag>
|
|||||||
typedef test_allocator<int, AllocatorTag> allocator_type;
|
typedef test_allocator<int, AllocatorTag> allocator_type;
|
||||||
typedef allocator_type allocator_constructor_type;
|
typedef allocator_type allocator_constructor_type;
|
||||||
typedef allocator_arg_t allocator_arg_type;
|
typedef allocator_arg_t allocator_arg_type;
|
||||||
|
struct nat{};
|
||||||
|
typedef nat std_allocator_arg_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<unsigned int AllocatorTag>
|
||||||
|
struct uses_allocator_base<ConstructibleStdPrefix, AllocatorTag>
|
||||||
|
{
|
||||||
|
typedef test_allocator<int, AllocatorTag> allocator_type;
|
||||||
|
typedef allocator_type allocator_constructor_type;
|
||||||
|
struct nat{};
|
||||||
|
typedef nat allocator_arg_type;
|
||||||
|
typedef const std::allocator_arg_t& std_allocator_arg_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<unsigned int AllocatorTag>
|
template<unsigned int AllocatorTag>
|
||||||
@@ -149,6 +168,8 @@ struct uses_allocator_base<NotUsesAllocator, AllocatorTag>
|
|||||||
struct nat{};
|
struct nat{};
|
||||||
typedef nat allocator_constructor_type;
|
typedef nat allocator_constructor_type;
|
||||||
typedef nat allocator_arg_type;
|
typedef nat allocator_arg_type;
|
||||||
|
struct nat2{};
|
||||||
|
typedef nat2 std_allocator_arg_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<ConstructionTypeEnum ConstructionType, unsigned int AllocatorTag>
|
template<ConstructionTypeEnum ConstructionType, unsigned int AllocatorTag>
|
||||||
@@ -177,6 +198,11 @@ struct mark_on_scoped_allocation
|
|||||||
: construction_type(ConstructiblePrefix), value(0)
|
: construction_type(ConstructiblePrefix), value(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
explicit mark_on_scoped_allocation
|
||||||
|
(typename base_type::std_allocator_arg_type, typename base_type::allocator_constructor_type)
|
||||||
|
: construction_type(ConstructibleStdPrefix), value(0)
|
||||||
|
{}
|
||||||
|
|
||||||
//1 user argument constructors
|
//1 user argument constructors
|
||||||
explicit mark_on_scoped_allocation(int i)
|
explicit mark_on_scoped_allocation(int i)
|
||||||
: construction_type(NotUsesAllocator), value(i)
|
: construction_type(NotUsesAllocator), value(i)
|
||||||
@@ -194,6 +220,13 @@ struct mark_on_scoped_allocation
|
|||||||
: construction_type(ConstructiblePrefix), value(i)
|
: construction_type(ConstructiblePrefix), value(i)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
mark_on_scoped_allocation
|
||||||
|
( typename base_type::std_allocator_arg_type
|
||||||
|
, typename base_type::allocator_constructor_type
|
||||||
|
, int i)
|
||||||
|
: construction_type(ConstructibleStdPrefix), value(i)
|
||||||
|
{}
|
||||||
|
|
||||||
//Copy constructors
|
//Copy constructors
|
||||||
mark_on_scoped_allocation(const mark_on_scoped_allocation &other)
|
mark_on_scoped_allocation(const mark_on_scoped_allocation &other)
|
||||||
: construction_type(NotUsesAllocator), value(other.value)
|
: construction_type(NotUsesAllocator), value(other.value)
|
||||||
@@ -210,6 +243,12 @@ struct mark_on_scoped_allocation
|
|||||||
: construction_type(ConstructiblePrefix), value(other.value)
|
: construction_type(ConstructiblePrefix), value(other.value)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
mark_on_scoped_allocation( typename base_type::std_allocator_arg_type
|
||||||
|
, typename base_type::allocator_constructor_type
|
||||||
|
, const mark_on_scoped_allocation &other)
|
||||||
|
: construction_type(ConstructibleStdPrefix), value(other.value)
|
||||||
|
{}
|
||||||
|
|
||||||
//Move constructors
|
//Move constructors
|
||||||
mark_on_scoped_allocation(BOOST_RV_REF(mark_on_scoped_allocation) other)
|
mark_on_scoped_allocation(BOOST_RV_REF(mark_on_scoped_allocation) other)
|
||||||
: construction_type(NotUsesAllocator), value(other.value)
|
: construction_type(NotUsesAllocator), value(other.value)
|
||||||
@@ -226,6 +265,12 @@ struct mark_on_scoped_allocation
|
|||||||
: construction_type(ConstructiblePrefix), value(other.value)
|
: construction_type(ConstructiblePrefix), value(other.value)
|
||||||
{ other.value = 0; other.construction_type = ConstructiblePrefix; }
|
{ other.value = 0; other.construction_type = ConstructiblePrefix; }
|
||||||
|
|
||||||
|
mark_on_scoped_allocation( typename base_type::std_allocator_arg_type
|
||||||
|
, typename base_type::allocator_constructor_type
|
||||||
|
, BOOST_RV_REF(mark_on_scoped_allocation) other)
|
||||||
|
: construction_type(ConstructibleStdPrefix), value(other.value)
|
||||||
|
{ other.value = 0; other.construction_type = ConstructibleStdPrefix; }
|
||||||
|
|
||||||
ConstructionTypeEnum construction_type;
|
ConstructionTypeEnum construction_type;
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
@@ -240,6 +285,13 @@ struct constructible_with_allocator_prefix
|
|||||||
static const bool value = true;
|
static const bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<unsigned int AllocatorTag>
|
||||||
|
struct constructible_with_std_allocator_prefix
|
||||||
|
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, AllocatorTag> >
|
||||||
|
{
|
||||||
|
static const bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
template<unsigned int AllocatorTag>
|
template<unsigned int AllocatorTag>
|
||||||
struct constructible_with_allocator_suffix
|
struct constructible_with_allocator_suffix
|
||||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, AllocatorTag> >
|
< ::mark_on_scoped_allocation<ConstructibleSuffix, AllocatorTag> >
|
||||||
@@ -767,12 +819,18 @@ int main()
|
|||||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
|
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
|
||||||
, test_allocator<float, 0>
|
, test_allocator<float, 0>
|
||||||
>::value ));
|
>::value ));
|
||||||
|
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||||
|
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0>
|
||||||
|
, test_allocator<float, 0>
|
||||||
|
>::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
|
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
|
||||||
, test_allocator<float, 0>
|
, test_allocator<float, 0>
|
||||||
>::value ));
|
>::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
|
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
|
||||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
|
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
|
||||||
|
BOOST_STATIC_ASSERT(( boost::container::constructible_with_std_allocator_prefix
|
||||||
|
< ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> >::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_suffix
|
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_suffix
|
||||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0> >::value ));
|
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0> >::value ));
|
||||||
|
|
||||||
@@ -820,6 +878,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
s0i.construct(&dummy);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 0){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
|
|
||||||
//Check construction with 1 user arguments
|
//Check construction with 1 user arguments
|
||||||
{
|
{
|
||||||
@@ -858,6 +928,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
s0i.construct(&dummy, 3);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 3){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
||||||
@@ -903,6 +985,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 1> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
s1i.construct(&dummy);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 0){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
|
|
||||||
//Check construction with 1 user arguments
|
//Check construction with 1 user arguments
|
||||||
{
|
{
|
||||||
@@ -941,6 +1035,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 1> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
s1i.construct(&dummy, 3);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 3){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1008,6 +1114,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
ssro0i.construct(&dummy);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 0){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
|
|
||||||
//Check construction with 1 user arguments
|
//Check construction with 1 user arguments
|
||||||
{
|
{
|
||||||
@@ -1046,6 +1164,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
ssro0i.construct(&dummy, 3);
|
||||||
|
if(dummy.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.value != 3){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
//Then check scoped allocator with OuterAlloc and InnerAlloc.
|
||||||
@@ -1115,6 +1245,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 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
|
//Check construction with 1 user arguments
|
||||||
{
|
{
|
||||||
@@ -1153,6 +1295,18 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkType();
|
dummy.~MarkType();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 10> MarkType;
|
||||||
|
MarkType dummy;
|
||||||
|
dummy.~MarkType();
|
||||||
|
ssro1i.construct(&dummy, 3);
|
||||||
|
if(dummy.construction_type != NotUsesAllocator ||
|
||||||
|
dummy.value != 3){
|
||||||
|
dummy.~MarkType();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -1216,6 +1370,21 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||||
|
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||||
|
MarkTypePair dummy;
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
s0i.construct(&dummy);
|
||||||
|
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 0 ||
|
||||||
|
dummy.second.value != 0 ){
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
|
|
||||||
//Check construction with 1 user arguments for each pair
|
//Check construction with 1 user arguments for each pair
|
||||||
{
|
{
|
||||||
@@ -1263,6 +1432,21 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||||
|
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||||
|
MarkTypePair dummy;
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
s0i.construct(&dummy, 2, 2);
|
||||||
|
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 2 ||
|
||||||
|
dummy.second.value != 2 ){
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
//Check construction with pair copy construction
|
//Check construction with pair copy construction
|
||||||
{
|
{
|
||||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||||
@@ -1309,6 +1493,21 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 0> MarkType;
|
||||||
|
typedef pair<MarkType, MarkType> MarkTypePair;
|
||||||
|
MarkTypePair dummy, dummy2(2, 2);
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
s0i.construct(&dummy, dummy2);
|
||||||
|
if(dummy.first.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 2 ||
|
||||||
|
dummy.second.value != 2 ){
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
//Check construction with pair move construction
|
//Check construction with pair move construction
|
||||||
{
|
{
|
||||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||||
@@ -1368,6 +1567,25 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 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 != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 2 ||
|
||||||
|
dummy.second.value != 2 ||
|
||||||
|
dummy2.first.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy2.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy2.first.value != 0 ||
|
||||||
|
dummy2.second.value != 0 ){
|
||||||
|
dummy2.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
//Check construction with related pair copy construction
|
//Check construction with related pair copy construction
|
||||||
{
|
{
|
||||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||||
@@ -1417,6 +1635,22 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 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 != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 2 ||
|
||||||
|
dummy.second.value != 2 ){
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
//Check construction with related pair move construction
|
//Check construction with related pair move construction
|
||||||
{
|
{
|
||||||
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
typedef ::mark_on_scoped_allocation<NotUsesAllocator, 0> MarkType;
|
||||||
@@ -1466,6 +1700,22 @@ int main()
|
|||||||
}
|
}
|
||||||
dummy.~MarkTypePair();
|
dummy.~MarkTypePair();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
typedef ::mark_on_scoped_allocation<ConstructibleStdPrefix, 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 != ConstructibleStdPrefix ||
|
||||||
|
dummy.second.construction_type != ConstructibleStdPrefix ||
|
||||||
|
dummy.first.value != 2 ||
|
||||||
|
dummy.second.value != 2 ){
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
dummy.~MarkTypePair();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user