@@ -94,23 +94,6 @@ BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...arg
94
94
::new ((void *)p, boost_container_new_t ()) T (::boost::forward<Args>(args)...);
95
95
}
96
96
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
-
114
97
#else
115
98
116
99
#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ (N ) \
@@ -125,32 +108,12 @@ construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
125
108
BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ)
126
109
#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ
127
110
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
-
148
111
#endif
149
112
150
113
template <class T >
151
114
inline
152
115
typename dtl::enable_if<dtl::is_pair<T>, void >::type
153
- construct_type (T* p)
116
+ construct_type (T* p)
154
117
{
155
118
dtl::construct_type (dtl::addressof (p->first ));
156
119
BOOST_CONTAINER_TRY{
@@ -164,7 +127,6 @@ construct_type(T* p)
164
127
BOOST_CONTAINER_CATCH_END
165
128
}
166
129
167
-
168
130
template <class T , class U >
169
131
inline
170
132
typename dtl::enable_if_c
@@ -509,6 +471,25 @@ struct allocator_traits
509
471
}
510
472
#endif
511
473
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
+
512
493
// ! <b>Returns</b>: <code>a.storage_is_unpropagable(p)</code> if is_partially_propagable::value is true; otherwise,
513
494
// ! <code>false</code>.
514
495
inline static bool storage_is_unpropagable (const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW
@@ -582,6 +563,22 @@ struct allocator_traits
582
563
inline static void priv_construct (dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args)
583
564
{ a.construct ( p, ::boost::forward<Args>(args)...); }
584
565
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
+
585
582
template <class T , class ...Args>
586
583
inline static void priv_construct (dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args)
587
584
{ dtl::construct_type (p, ::boost::forward<Args>(args)...); }
@@ -600,6 +597,28 @@ struct allocator_traits
600
597
dtl::bool_<value> flag;\
601
598
(priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
602
599
}\
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
+ \
603
622
//
604
623
BOOST_MOVE_ITERATE_0TO8 (BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL)
605
624
#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL
0 commit comments