• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2008. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/container for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 #ifndef BOOST_CONTAINER_TEST_EMPLACE_TEST_HPP
11 #define BOOST_CONTAINER_TEST_EMPLACE_TEST_HPP
12 
13 #include <iostream>
14 #include <typeinfo>
15 #include <boost/container/detail/config_begin.hpp>
16 #include <boost/container/detail/workaround.hpp>
17 #include <boost/container/detail/mpl.hpp>
18 #include <boost/move/utility_core.hpp>
19 #include <boost/container/detail/type_traits.hpp>
20 
21 namespace boost{
22 namespace container {
23 namespace test{
24 
25 class EmplaceInt
26 {
27    BOOST_MOVABLE_BUT_NOT_COPYABLE(EmplaceInt)
28 
29    public:
EmplaceInt(int a=0,int b=0,int c=0,int d=0,int e=0)30    EmplaceInt(int a = 0, int b = 0, int c = 0, int d = 0, int e = 0)
31       : a_(a), b_(b), c_(c), d_(d), e_(e)
32    {}
33 
EmplaceInt(BOOST_RV_REF (EmplaceInt)o)34    EmplaceInt(BOOST_RV_REF(EmplaceInt) o)
35       : a_(o.a_), b_(o.b_), c_(o.c_), d_(o.d_), e_(o.e_)
36    {}
37 
operator =(BOOST_RV_REF (EmplaceInt)o)38    EmplaceInt& operator=(BOOST_RV_REF(EmplaceInt) o)
39    {
40       this->a_ = o.a_;
41       this->b_ = o.b_;
42       this->c_ = o.c_;
43       this->d_ = o.d_;
44       this->e_ = o.e_;
45       return *this;
46    }
47 
operator ==(const EmplaceInt & l,const EmplaceInt & r)48    friend bool operator==(const EmplaceInt &l, const EmplaceInt &r)
49    {
50       return l.a_ == r.a_ &&
51              l.b_ == r.b_ &&
52              l.c_ == r.c_ &&
53              l.d_ == r.d_ &&
54              l.e_ == r.e_;
55    }
56 
operator <(const EmplaceInt & l,const EmplaceInt & r)57    friend bool operator<(const EmplaceInt &l, const EmplaceInt &r)
58    {  return l.sum() < r.sum(); }
59 
operator >(const EmplaceInt & l,const EmplaceInt & r)60    friend bool operator>(const EmplaceInt &l, const EmplaceInt &r)
61    {  return l.sum() > r.sum(); }
62 
operator !=(const EmplaceInt & l,const EmplaceInt & r)63    friend bool operator!=(const EmplaceInt &l, const EmplaceInt &r)
64    {  return !(l == r); }
65 
hash_value(const EmplaceInt & v)66    friend std::size_t hash_value(const EmplaceInt &v)
67    {  return std::size_t(v.a_); }
68 
operator <<(std::ostream & os,const EmplaceInt & v)69    friend std::ostream &operator <<(std::ostream &os, const EmplaceInt &v)
70    {
71       os << "EmplaceInt: " << v.a_ << ' ' << v.b_ << ' ' << v.c_ << ' ' << v.d_ << ' ' << v.e_;
72       return os;
73    }
74 
~EmplaceInt()75    ~EmplaceInt()
76    {  a_ = b_ = c_ = d_ = e_ = 0; }
77 
78    //private:
sum() const79    int sum() const
80    {  return this->a_ + this->b_ + this->c_ + this->d_ + this->e_; }
81 
82    int a_, b_, c_, d_, e_;
83    int padding[6];
84 };
85 
86 
87 }  //namespace test {
88 
89 namespace test {
90 
91 enum EmplaceOptions{
92    EMPLACE_BACK         = 1 << 0,
93    EMPLACE_FRONT        = 1 << 1,
94    EMPLACE_BEFORE       = 1 << 2,
95    EMPLACE_AFTER        = 1 << 3,
96    EMPLACE_ASSOC        = 1 << 4,
97    EMPLACE_HINT         = 1 << 5,
98    EMPLACE_ASSOC_PAIR   = 1 << 6,
99    EMPLACE_HINT_PAIR    = 1 << 7
100 };
101 
102 template<class Container>
test_expected_container(const Container & ec,const EmplaceInt * Expected,unsigned int only_first_n,unsigned int cont_offset=0)103 bool test_expected_container(const Container &ec, const EmplaceInt *Expected, unsigned int only_first_n, unsigned int cont_offset = 0)
104 {
105    typedef typename Container::const_iterator const_iterator;
106    const_iterator itb(ec.begin()), ite(ec.end());
107    unsigned int cur = 0;
108    if(cont_offset > ec.size()){
109       return false;
110    }
111    if(only_first_n > (ec.size() - cont_offset)){
112       return false;
113    }
114    while(cont_offset--){
115       ++itb;
116    }
117    for(; itb != ite && only_first_n--; ++itb, ++cur){
118       const EmplaceInt & cr = *itb;
119       if(cr != Expected[cur]){
120          return false;
121       }
122    }
123    return true;
124 }
125 
126 template<class Container>
test_expected_container(const Container & ec,const std::pair<EmplaceInt,EmplaceInt> * Expected,unsigned int only_first_n)127 bool test_expected_container(const Container &ec, const std::pair<EmplaceInt, EmplaceInt> *Expected, unsigned int only_first_n)
128 {
129    typedef typename Container::const_iterator const_iterator;
130    const_iterator itb(ec.begin()), ite(ec.end());
131    unsigned int cur = 0;
132    if(only_first_n > ec.size()){
133       return false;
134    }
135    for(; itb != ite && only_first_n--; ++itb, ++cur){
136       if(itb->first != Expected[cur].first){
137          std::cout << "Error in first: " << itb->first << ' ' << Expected[cur].first << std::endl;
138          return false;
139 
140       }
141       else if(itb->second != Expected[cur].second){
142          std::cout << "Error in second: " << itb->second << ' ' << Expected[cur].second << std::endl;
143          return false;
144       }
145    }
146    return true;
147 }
148 
149 typedef std::pair<EmplaceInt, EmplaceInt> EmplaceIntPair;
150 static boost::container::dtl::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
151 
initialize_emplace_int_pair()152 static EmplaceIntPair* initialize_emplace_int_pair()
153 {
154    EmplaceIntPair* ret = reinterpret_cast<EmplaceIntPair*>(&pair_storage);
155    for(unsigned int i = 0; i != 10; ++i){
156       new(&ret->first)EmplaceInt();
157       new(&ret->second)EmplaceInt();
158    }
159    return ret;
160 }
161 
162 static EmplaceIntPair * expected_pair = initialize_emplace_int_pair();
163 
164 
165 template<class Container>
test_emplace_back(dtl::true_)166 bool test_emplace_back(dtl::true_)
167 {
168    std::cout << "Starting test_emplace_back." << std::endl << "  Class: "
169       << typeid(Container).name() << std::endl;
170    static EmplaceInt expected [10];
171 
172    {
173       new(&expected [0]) EmplaceInt();
174       new(&expected [1]) EmplaceInt(1);
175       new(&expected [2]) EmplaceInt(1, 2);
176       new(&expected [3]) EmplaceInt(1, 2, 3);
177       new(&expected [4]) EmplaceInt(1, 2, 3, 4);
178       new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
179       Container c;
180       typedef typename Container::reference reference;
181       {
182          reference r = c.emplace_back();
183          if(&r != &c.back() && !test_expected_container(c, &expected[0], 1)){
184             return false;
185          }
186       }
187       {
188          reference r = c.emplace_back(1);
189          if(&r != &c.back() && !test_expected_container(c, &expected[0], 2)){
190             return false;
191          }
192       }
193       c.emplace_back(1, 2);
194       if(!test_expected_container(c, &expected[0], 3)){
195          return false;
196       }
197       c.emplace_back(1, 2, 3);
198       if(!test_expected_container(c, &expected[0], 4)){
199          return false;
200       }
201       c.emplace_back(1, 2, 3, 4);
202       if(!test_expected_container(c, &expected[0], 5)){
203          return false;
204       }
205       c.emplace_back(1, 2, 3, 4, 5);
206       if(!test_expected_container(c, &expected[0], 6)){
207          return false;
208       }
209    }
210    std::cout << "...OK" << std::endl;
211    return true;
212 }
213 
214 template<class Container>
test_emplace_back(dtl::false_)215 bool test_emplace_back(dtl::false_)
216 {  return true;   }
217 
218 template<class Container>
test_emplace_front(dtl::true_)219 bool test_emplace_front(dtl::true_)
220 {
221    std::cout << "Starting test_emplace_front." << std::endl << "  Class: "
222       << typeid(Container).name() << std::endl;
223    static EmplaceInt expected [10];
224    {
225       new(&expected [0]) EmplaceInt(1, 2, 3, 4, 5);
226       new(&expected [1]) EmplaceInt(1, 2, 3, 4);
227       new(&expected [2]) EmplaceInt(1, 2, 3);
228       new(&expected [3]) EmplaceInt(1, 2);
229       new(&expected [4]) EmplaceInt(1);
230       new(&expected [5]) EmplaceInt();
231       Container c;
232       typedef typename Container::reference reference;
233       {
234          reference r = c.emplace_front();
235          if(&r != &c.front() && !test_expected_container(c, &expected[0] + 5, 1)){
236             return false;
237          }
238       }
239       {
240          reference r = c.emplace_front(1);
241          if(&r != &c.front() && !test_expected_container(c, &expected[0] + 4, 2)){
242             return false;
243          }
244       }
245       c.emplace_front(1, 2);
246       if(!test_expected_container(c, &expected[0] + 3, 3)){
247          return false;
248       }
249       c.emplace_front(1, 2, 3);
250       if(!test_expected_container(c, &expected[0] + 2, 4)){
251          return false;
252       }
253       c.emplace_front(1, 2, 3, 4);
254       if(!test_expected_container(c, &expected[0] + 1, 5)){
255          return false;
256       }
257       c.emplace_front(1, 2, 3, 4, 5);
258       if(!test_expected_container(c, &expected[0] + 0, 6)){
259          return false;
260       }
261    }
262    std::cout << "...OK" << std::endl;
263    return true;
264 }
265 
266 template<class Container>
test_emplace_front(dtl::false_)267 bool test_emplace_front(dtl::false_)
268 {  return true;   }
269 
270 template<class Container>
test_emplace_before(dtl::true_)271 bool test_emplace_before(dtl::true_)
272 {
273    std::cout << "Starting test_emplace_before." << std::endl << "  Class: "
274       << typeid(Container).name() << std::endl;
275    static EmplaceInt expected [10];
276    {
277       new(&expected [0]) EmplaceInt();
278       new(&expected [1]) EmplaceInt(1);
279       new(&expected [2]) EmplaceInt();
280       Container c;
281       c.emplace(c.cend(), 1);
282       c.emplace(c.cbegin());
283       if(!test_expected_container(c, &expected[0], 2)){
284          return false;
285       }
286       c.emplace(c.cend());
287       if(!test_expected_container(c, &expected[0], 3)){
288          return false;
289       }
290    }
291    {
292       new(&expected [0]) EmplaceInt();
293       new(&expected [1]) EmplaceInt(1);
294       new(&expected [2]) EmplaceInt(1, 2);
295       new(&expected [3]) EmplaceInt(1, 2, 3);
296       new(&expected [4]) EmplaceInt(1, 2, 3, 4);
297       new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
298       //emplace_front-like
299       Container c;
300       c.emplace(c.cbegin(), 1, 2, 3, 4, 5);
301       c.emplace(c.cbegin(), 1, 2, 3, 4);
302       c.emplace(c.cbegin(), 1, 2, 3);
303       c.emplace(c.cbegin(), 1, 2);
304       c.emplace(c.cbegin(), 1);
305       c.emplace(c.cbegin());
306       if(!test_expected_container(c, &expected[0], 6)){
307          return false;
308       }
309       c.clear();
310       //emplace_back-like
311       typename Container::const_iterator i = c.emplace(c.cend());
312       if(!test_expected_container(c, &expected[0], 1)){
313          return false;
314       }
315       i = c.emplace(++i, 1);
316       if(!test_expected_container(c, &expected[0], 2)){
317          return false;
318       }
319       i = c.emplace(++i, 1, 2);
320       if(!test_expected_container(c, &expected[0], 3)){
321          return false;
322       }
323       i = c.emplace(++i, 1, 2, 3);
324       if(!test_expected_container(c, &expected[0], 4)){
325          return false;
326       }
327       i = c.emplace(++i, 1, 2, 3, 4);
328       if(!test_expected_container(c, &expected[0], 5)){
329          return false;
330       }
331       i = c.emplace(++i, 1, 2, 3, 4, 5);
332       if(!test_expected_container(c, &expected[0], 6)){
333          return false;
334       }
335       c.clear();
336       //emplace in the middle
337       c.emplace(c.cbegin());
338       if(!test_expected_container(c, &expected[0], 1)){
339          return false;
340       }
341       i = c.emplace(c.cend(), 1, 2, 3, 4, 5);
342       if(!test_expected_container(c, &expected[0], 1)){
343          return false;
344       }
345       if(!test_expected_container(c, &expected[5], 1, 1)){
346          return false;
347       }
348       i = c.emplace(i, 1, 2, 3, 4);
349       if(!test_expected_container(c, &expected[0], 1)){
350          return false;
351       }
352       if(!test_expected_container(c, &expected[4], 2, 1)){
353          return false;
354       }
355       i = c.emplace(i, 1, 2, 3);
356       if(!test_expected_container(c, &expected[0], 1)){
357          return false;
358       }
359       if(!test_expected_container(c, &expected[3], 3, 1)){
360          return false;
361       }
362       i = c.emplace(i, 1, 2);
363       if(!test_expected_container(c, &expected[0], 1)){
364          return false;
365       }
366       if(!test_expected_container(c, &expected[2], 4, 1)){
367          return false;
368       }
369       i = c.emplace(i, 1);
370       if(!test_expected_container(c, &expected[0], 6)){
371          return false;
372       }
373       std::cout << "...OK" << std::endl;
374    }
375    return true;
376 }
377 
378 template<class Container>
test_emplace_before(dtl::false_)379 bool test_emplace_before(dtl::false_)
380 {  return true;   }
381 
382 template<class Container>
test_emplace_after(dtl::true_)383 bool test_emplace_after(dtl::true_)
384 {
385    std::cout << "Starting test_emplace_after." << std::endl << "  Class: "
386       << typeid(Container).name() << std::endl;
387    static EmplaceInt expected [10];
388    {
389       new(&expected [0]) EmplaceInt();
390       new(&expected [1]) EmplaceInt(1);
391       new(&expected [2]) EmplaceInt();
392       Container c;
393       typename Container::const_iterator i = c.emplace_after(c.cbefore_begin(), 1);
394       c.emplace_after(c.cbefore_begin());
395       if(!test_expected_container(c, &expected[0], 2)){
396          return false;
397       }
398       c.emplace_after(i);
399       if(!test_expected_container(c, &expected[0], 3)){
400          return false;
401       }
402    }
403    {
404       new(&expected [0]) EmplaceInt();
405       new(&expected [1]) EmplaceInt(1);
406       new(&expected [2]) EmplaceInt(1, 2);
407       new(&expected [3]) EmplaceInt(1, 2, 3);
408       new(&expected [4]) EmplaceInt(1, 2, 3, 4);
409       new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
410       //emplace_front-like
411       Container c;
412       c.emplace_after(c.cbefore_begin(), 1, 2, 3, 4, 5);
413       c.emplace_after(c.cbefore_begin(), 1, 2, 3, 4);
414       c.emplace_after(c.cbefore_begin(), 1, 2, 3);
415       c.emplace_after(c.cbefore_begin(), 1, 2);
416       c.emplace_after(c.cbefore_begin(), 1);
417       c.emplace_after(c.cbefore_begin());
418       if(!test_expected_container(c, &expected[0], 6)){
419          return false;
420       }
421       c.clear();
422       //emplace_back-like
423       typename Container::const_iterator i = c.emplace_after(c.cbefore_begin());
424       if(!test_expected_container(c, &expected[0], 1)){
425          return false;
426       }
427       i = c.emplace_after(i, 1);
428       if(!test_expected_container(c, &expected[0], 2)){
429          return false;
430       }
431       i = c.emplace_after(i, 1, 2);
432       if(!test_expected_container(c, &expected[0], 3)){
433          return false;
434       }
435       i = c.emplace_after(i, 1, 2, 3);
436       if(!test_expected_container(c, &expected[0], 4)){
437          return false;
438       }
439       i = c.emplace_after(i, 1, 2, 3, 4);
440       if(!test_expected_container(c, &expected[0], 5)){
441          return false;
442       }
443       i = c.emplace_after(i, 1, 2, 3, 4, 5);
444       if(!test_expected_container(c, &expected[0], 6)){
445          return false;
446       }
447       c.clear();
448       //emplace_after in the middle
449       i = c.emplace_after(c.cbefore_begin());
450       c.emplace_after(i, 1, 2, 3, 4, 5);
451       c.emplace_after(i, 1, 2, 3, 4);
452       c.emplace_after(i, 1, 2, 3);
453       c.emplace_after(i, 1, 2);
454       c.emplace_after(i, 1);
455 
456       if(!test_expected_container(c, &expected[0], 6)){
457          return false;
458       }
459       std::cout << "...OK" << std::endl;
460    }
461    return true;
462 }
463 
464 template<class Container>
test_emplace_after(dtl::false_)465 bool test_emplace_after(dtl::false_)
466 {  return true;   }
467 
468 template<class Container>
test_emplace_assoc(dtl::true_)469 bool test_emplace_assoc(dtl::true_)
470 {
471    std::cout << "Starting test_emplace_assoc." << std::endl << "  Class: "
472       << typeid(Container).name() << std::endl;
473    static EmplaceInt expected [10];
474    new(&expected [0]) EmplaceInt();
475    new(&expected [1]) EmplaceInt(1);
476    new(&expected [2]) EmplaceInt(1, 2);
477    new(&expected [3]) EmplaceInt(1, 2, 3);
478    new(&expected [4]) EmplaceInt(1, 2, 3, 4);
479    new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
480    {
481       Container c;
482       c.emplace();
483       if(!test_expected_container(c, &expected[0], 1)){
484          return false;
485       }
486       c.emplace(1);
487       if(!test_expected_container(c, &expected[0], 2)){
488          return false;
489       }
490       c.emplace(1, 2);
491       if(!test_expected_container(c, &expected[0], 3)){
492          return false;
493       }
494       c.emplace(1, 2, 3);
495       if(!test_expected_container(c, &expected[0], 4)){
496          return false;
497       }
498       c.emplace(1, 2, 3, 4);
499       if(!test_expected_container(c, &expected[0], 5)){
500          return false;
501       }
502       c.emplace(1, 2, 3, 4, 5);
503       if(!test_expected_container(c, &expected[0], 6)){
504          return false;
505       }
506       std::cout << "...OK" << std::endl;
507    }
508    return true;
509 }
510 
511 template<class Container>
test_emplace_assoc(dtl::false_)512 bool test_emplace_assoc(dtl::false_)
513 {  return true;   }
514 
515 template<class Container>
test_emplace_hint(dtl::true_)516 bool test_emplace_hint(dtl::true_)
517 {
518    std::cout << "Starting test_emplace_hint." << std::endl << "  Class: "
519       << typeid(Container).name() << std::endl;
520    static EmplaceInt expected [10];
521    new(&expected [0]) EmplaceInt();
522    new(&expected [1]) EmplaceInt(1);
523    new(&expected [2]) EmplaceInt(1, 2);
524    new(&expected [3]) EmplaceInt(1, 2, 3);
525    new(&expected [4]) EmplaceInt(1, 2, 3, 4);
526    new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
527 
528    {
529       Container c;
530       typename Container::const_iterator it;
531       it = c.emplace_hint(c.begin());
532       if(!test_expected_container(c, &expected[0], 1)){
533          return false;
534       }
535       it = c.emplace_hint(it, 1);
536       if(!test_expected_container(c, &expected[0], 2)){
537          return false;
538       }
539       it = c.emplace_hint(it, 1, 2);
540       if(!test_expected_container(c, &expected[0], 3)){
541          return false;
542       }
543       it = c.emplace_hint(it, 1, 2, 3);
544       if(!test_expected_container(c, &expected[0], 4)){
545          return false;
546       }
547       it = c.emplace_hint(it, 1, 2, 3, 4);
548       if(!test_expected_container(c, &expected[0], 5)){
549          return false;
550       }
551       it = c.emplace_hint(it, 1, 2, 3, 4, 5);
552       if(!test_expected_container(c, &expected[0], 6)){
553          return false;
554       }
555       std::cout << "...OK" << std::endl;
556    }
557 
558    return true;
559 }
560 
561 template<class Container>
test_emplace_hint(dtl::false_)562 bool test_emplace_hint(dtl::false_)
563 {  return true;   }
564 
565 template<class Container>
test_emplace_assoc_pair(dtl::true_)566 bool test_emplace_assoc_pair(dtl::true_)
567 {
568    std::cout << "Starting test_emplace_assoc_pair." << std::endl << "  Class: "
569       << typeid(Container).name() << std::endl;
570 
571    new(&expected_pair[0].first)  EmplaceInt();
572    new(&expected_pair[0].second) EmplaceInt();
573    new(&expected_pair[1].first)  EmplaceInt(1);
574    new(&expected_pair[1].second) EmplaceInt(1);
575    new(&expected_pair[2].first)  EmplaceInt(2);
576    new(&expected_pair[2].second) EmplaceInt(2);
577    {
578       Container c;
579       c.emplace();
580       if(!test_expected_container(c, &expected_pair[0], 1)){
581          std::cout << "Error after c.emplace();\n";
582          return false;
583       }
584       c.emplace(1, 1);
585       if(!test_expected_container(c, &expected_pair[0], 2)){
586          std::cout << "Error after c.emplace(1);\n";
587          return false;
588       }
589       c.emplace(2, 2);
590       if(!test_expected_container(c, &expected_pair[0], 3)){
591          std::cout << "Error after c.emplace(2, 2);\n";
592          return false;
593       }
594       std::cout << "...OK" << std::endl;
595    }
596    return true;
597 }
598 
599 template<class Container>
test_emplace_assoc_pair(dtl::false_)600 bool test_emplace_assoc_pair(dtl::false_)
601 {  return true;   }
602 
603 template<class Container>
test_emplace_hint_pair(dtl::true_)604 bool test_emplace_hint_pair(dtl::true_)
605 {
606    std::cout << "Starting test_emplace_hint_pair." << std::endl << "  Class: "
607       << typeid(Container).name() << std::endl;
608 
609    new(&expected_pair[0].first)  EmplaceInt();
610    new(&expected_pair[0].second) EmplaceInt();
611    new(&expected_pair[1].first)  EmplaceInt(1);
612    new(&expected_pair[1].second) EmplaceInt(1);
613    new(&expected_pair[2].first)  EmplaceInt(2);
614    new(&expected_pair[2].second) EmplaceInt(2);
615    {
616       Container c;
617       typename Container::const_iterator it;
618       it = c.emplace_hint(c.begin());
619       if(!test_expected_container(c, &expected_pair[0], 1)){
620          std::cout << "Error after c.emplace(1);\n";
621          return false;
622       }
623       it = c.emplace_hint(it, 1, 1);
624       if(!test_expected_container(c, &expected_pair[0], 2)){
625          std::cout << "Error after c.emplace(it, 1);\n";
626          return false;
627       }
628       it = c.emplace_hint(it, 2, 2);
629       if(!test_expected_container(c, &expected_pair[0], 3)){
630          std::cout << "Error after c.emplace(it, 2, 2);\n";
631          return false;
632       }
633       std::cout << "...OK" << std::endl;
634    }
635    return true;
636 }
637 
638 template<class Container>
test_emplace_hint_pair(dtl::false_)639 bool test_emplace_hint_pair(dtl::false_)
640 {  return true;   }
641 
642 template <EmplaceOptions O, EmplaceOptions Mask>
643 struct emplace_active
644 {
645    static const bool value = (0 != (O & Mask));
646    typedef dtl::bool_<value> type;
operator typeboost::container::test::emplace_active647    operator type() const{  return type(); }
648 };
649 
650 template<class Container, EmplaceOptions O>
test_emplace()651 bool test_emplace()
652 {
653    if(!test_emplace_back<Container>(emplace_active<O, EMPLACE_BACK>())){
654       return false;
655    }
656    if(!test_emplace_front<Container>(emplace_active<O, EMPLACE_FRONT>())){
657       return false;
658    }
659    if(!test_emplace_before<Container>(emplace_active<O, EMPLACE_BEFORE>())){
660       return false;
661    }
662    if(!test_emplace_after<Container>(emplace_active<O, EMPLACE_AFTER>())){
663       return false;
664    }
665    if(!test_emplace_assoc<Container>(emplace_active<O, EMPLACE_ASSOC>())){
666       return false;
667    }
668    if(!test_emplace_hint<Container>(emplace_active<O, EMPLACE_HINT>())){
669       return false;
670    }
671    if(!test_emplace_assoc_pair<Container>(emplace_active<O, EMPLACE_ASSOC_PAIR>())){
672       return false;
673    }
674    if(!test_emplace_hint_pair<Container>(emplace_active<O, EMPLACE_HINT_PAIR>())){
675       return false;
676    }
677    return true;
678 }
679 
680 }  //namespace test{
681 }  //namespace container {
682 }  //namespace boost{
683 
684 #include <boost/container/detail/config_end.hpp>
685 
686 #endif   //#ifndef BOOST_CONTAINER_TEST_EMPLACE_TEST_HPP
687