@@ -94,23 +94,6 @@ BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...arg
9494 ::new ((void *)p, boost_container_new_t ()) T (::boost::forward<Args>(args)...);
9595}
9696
97- template < class Pair , class KeyType , class ... Args>
98- typename dtl::enable_if< dtl::is_pair<Pair>, void >::type
99- construct_type
100- (Pair* p, try_emplace_t , BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args)
101- {
102- construct_type (dtl::addressof (p->first ), ::boost::forward<KeyType>(k));
103- BOOST_CONTAINER_TRY{
104- construct_type (dtl::addressof (p->second ), ::boost::forward<Args>(args)...);
105- }
106- BOOST_CONTAINER_CATCH (...) {
107- typedef typename Pair::first_type first_type;
108- dtl::addressof (p->first )->~first_type ();
109- BOOST_CONTAINER_RETHROW
110- }
111- BOOST_CONTAINER_CATCH_END
112- }
113-
11497#else
11598
11699#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ (N ) \
@@ -125,32 +108,12 @@ construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
125108BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ)
126109#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ
127110
128- #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE (N ) \
129- template < class Pair , class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\
130- typename dtl::enable_if< dtl::is_pair<Pair>, void >::type construct_type\
131- (Pair* p, try_emplace_t , BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
132- {\
133- construct_type (dtl::addressof (p->first ), ::boost::forward<KeyType>(k));\
134- BOOST_CONTAINER_TRY{\
135- construct_type (dtl::addressof (p->second ) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
136- }\
137- BOOST_CONTAINER_CATCH (...) {\
138- typedef typename Pair::first_type first_type;\
139- dtl::addressof (p->first )->~first_type ();\
140- BOOST_CONTAINER_RETHROW\
141- }\
142- BOOST_CONTAINER_CATCH_END\
143- }\
144- //
145- BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE)
146- #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE
147-
148111#endif
149112
150113template <class T >
151114inline
152115typename dtl::enable_if<dtl::is_pair<T>, void >::type
153- construct_type (T* p)
116+ construct_type (T* p)
154117{
155118 dtl::construct_type (dtl::addressof (p->first ));
156119 BOOST_CONTAINER_TRY{
@@ -164,7 +127,6 @@ construct_type(T* p)
164127 BOOST_CONTAINER_CATCH_END
165128}
166129
167-
168130template <class T , class U >
169131inline
170132typename dtl::enable_if_c
@@ -509,6 +471,25 @@ struct allocator_traits
509471 }
510472 #endif
511473
474+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
475+
476+ template < class Pair , class KeyType , class ... Args>
477+ static typename dtl::enable_if< dtl::is_pair<Pair>, void >::type construct
478+ (Allocator & a, Pair* p, try_emplace_t , BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args)
479+ {
480+ allocator_traits::construct (a, dtl::addressof (p->first ), ::boost::forward<KeyType>(k));
481+ BOOST_CONTAINER_TRY{
482+ allocator_traits::construct (a, dtl::addressof (p->second ), ::boost::forward<Args>(args)...);
483+ }
484+ BOOST_CONTAINER_CATCH (...) {
485+ typedef typename Pair::first_type first_type;
486+ dtl::addressof (p->first )->~first_type ();
487+ BOOST_CONTAINER_RETHROW
488+ }
489+ BOOST_CONTAINER_CATCH_END
490+ }
491+ #endif
492+
512493 // ! <b>Returns</b>: <code>a.storage_is_unpropagable(p)</code> if is_partially_propagable::value is true; otherwise,
513494 // ! <code>false</code>.
514495 inline static bool storage_is_unpropagable (const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW
@@ -582,6 +563,22 @@ struct allocator_traits
582563 inline static void priv_construct (dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args)
583564 { a.construct ( p, ::boost::forward<Args>(args)...); }
584565
566+ template <class T , class KeyType , class ...Args>
567+ inline static typename dtl::enable_if< dtl::is_pair<T>, void >::type
568+ priv_construct (dtl::true_type, Allocator &a, T *p, try_emplace_t , BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args)
569+ {
570+ a.construct (dtl::addressof (p->first ), ::boost::forward<KeyType>(k));
571+ BOOST_CONTAINER_TRY{
572+ a.construct (dtl::addressof (p->second ), ::boost::forward<Args>(args)...);
573+ }
574+ BOOST_CONTAINER_CATCH (...) {
575+ typedef typename T::first_type first_type;
576+ dtl::addressof (p->first )->~first_type ();
577+ BOOST_CONTAINER_RETHROW
578+ }
579+ BOOST_CONTAINER_CATCH_END
580+ }
581+
585582 template <class T , class ...Args>
586583 inline static void priv_construct (dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args)
587584 { dtl::construct_type (p, ::boost::forward<Args>(args)...); }
@@ -600,6 +597,28 @@ struct allocator_traits
600597 dtl::bool_<value> flag;\
601598 (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
602599 }\
600+ \
601+ //
602+ BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL)
603+ #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL
604+
605+ #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL (N ) \
606+ template <class T , class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
607+ inline static typename dtl::enable_if< dtl::is_pair<T>, void >::type\
608+ construct (Allocator &a, T *p, try_emplace_t , BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
609+ {\
610+ allocator_traits::construct (a, dtl::addressof (p->first ), ::boost::forward<KeyType>(k));\
611+ BOOST_CONTAINER_TRY{\
612+ allocator_traits::construct (a, dtl::addressof (p->second ) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
613+ }\
614+ BOOST_CONTAINER_CATCH (...) {\
615+ typedef typename T::first_type first_type;\
616+ dtl::addressof (p->first )->~first_type ();\
617+ BOOST_CONTAINER_RETHROW\
618+ }\
619+ BOOST_CONTAINER_CATCH_END\
620+ }\
621+ \
603622 //
604623 BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL)
605624 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL
0 commit comments