File indexing completed on 2025-01-18 09:47:41
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_PHOENIX_STL_CONTAINER_CONTAINER_HPP
0009 #define BOOST_PHOENIX_STL_CONTAINER_CONTAINER_HPP
0010
0011 #include <boost/phoenix/core/limits.hpp>
0012 #include <boost/mpl/and.hpp>
0013 #include <boost/mpl/not.hpp>
0014 #include <boost/mpl/or.hpp>
0015 #include <boost/mpl/void.hpp>
0016 #include <boost/phoenix/stl/container/detail/container.hpp>
0017 #include <boost/phoenix/function/adapt_callable.hpp>
0018 #include <boost/type_traits/is_const.hpp>
0019
0020 namespace boost { namespace phoenix
0021 {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 namespace stl
0086 {
0087 struct assign
0088 {
0089 template <typename Sig>
0090 struct result;
0091
0092 template <
0093 typename This
0094 , typename C
0095 , typename Arg1
0096 >
0097 struct result<This(C&, Arg1&)>
0098 {
0099 typedef typename add_reference<C>::type type;
0100 };
0101
0102 template <
0103 typename This
0104 , typename C
0105 , typename Arg1
0106 , typename Arg2
0107 >
0108 struct result<This(C&, Arg1, Arg2)>
0109 {
0110 typedef typename add_reference<C>::type type;
0111 };
0112
0113 template <
0114 typename This
0115 , typename C
0116 , typename Arg1
0117 , typename Arg2
0118 , typename Arg3
0119 >
0120 struct result<This(C&, Arg1, Arg2, Arg3)>
0121 {
0122 typedef typename add_reference<C>::type type;
0123 };
0124
0125 template <typename C, typename Arg1>
0126 C& operator()(C& c, Arg1 const & arg1) const
0127 {
0128 c.assign(arg1);
0129 return c;
0130 }
0131
0132 template <typename C, typename Arg1, typename Arg2>
0133 C& operator()(C& c, Arg1 arg1, Arg2 arg2) const
0134 {
0135 c.assign(arg1, arg2);
0136 return c;
0137 }
0138
0139 template <typename C, typename Arg1, typename Arg2, typename Arg3>
0140 C& operator()(
0141 C& c
0142 , Arg1 arg1
0143 , Arg2 arg2
0144 , Arg3 const & arg3
0145 ) const
0146 {
0147 return c.assign(arg1, arg2, arg3);
0148 }
0149 };
0150
0151 struct at_impl
0152 {
0153 template <typename Sig>
0154 struct result;
0155
0156 template <typename This, typename C, typename Index>
0157 struct result<This(C&, Index)>
0158 {
0159
0160 typedef typename C::value_type & type;
0161 };
0162
0163 template <typename C, typename Index>
0164 typename result<at_impl(C&, Index const&)>::type
0165 operator()(C& c, Index const &i) const
0166 {
0167 return c.at(i);
0168 }
0169
0170 template <typename This, typename C, typename Index>
0171 struct result<This(C const&, Index)>
0172 {
0173 typedef typename C::value_type const & type;
0174 };
0175
0176 template <typename C, typename Index>
0177 typename result<at_impl(C const&, Index const&)>::type
0178 operator()(C const& c, Index const &i) const
0179 {
0180 return c.at(i);
0181 }
0182 };
0183
0184 struct back
0185 {
0186 template <typename Sig>
0187 struct result;
0188
0189 template <typename This, typename C>
0190 struct result<This(C&)>
0191 {
0192 typedef
0193 typename const_qualified_reference_of<C>::type
0194 type;
0195 };
0196
0197 template <typename C>
0198 typename result<back(C&)>::type
0199 operator()(C& c) const
0200 {
0201 return c.back();
0202 }
0203 };
0204
0205 struct begin
0206 {
0207 template <typename Sig>
0208 struct result;
0209
0210 template <typename This, typename C>
0211 struct result<This(C&)>
0212 {
0213 typedef typename const_qualified_iterator_of<C>::type type;
0214 };
0215
0216 template <typename C>
0217 typename result<begin(C&)>::type
0218 operator()(C& c) const
0219 {
0220 return c.begin();
0221 }
0222 };
0223
0224 struct capacity
0225 {
0226 template <typename Sig>
0227 struct result;
0228
0229 template <typename This, typename C>
0230 struct result<This(C&)>
0231 {
0232 typedef typename size_type_of<C>::type type;
0233 };
0234
0235 template <typename C>
0236 typename result<capacity(C&)>::type
0237 operator()(C const& c) const
0238 {
0239 return c.capacity();
0240 }
0241 };
0242
0243 struct clear
0244 {
0245 typedef void result_type;
0246
0247 template <typename C>
0248 void operator()(C& c) const
0249 {
0250 return c.clear();
0251 }
0252 };
0253
0254 struct empty
0255 {
0256 typedef bool result_type;
0257
0258 template <typename C>
0259 bool operator()(C const& c) const
0260 {
0261 return c.empty();
0262 }
0263 };
0264
0265 struct end
0266 {
0267 template <typename Sig>
0268 struct result;
0269
0270 template <typename This, typename C>
0271 struct result<This(C&)>
0272 {
0273 typedef typename const_qualified_iterator_of<C>::type type;
0274 };
0275
0276 template <typename C>
0277 typename result<end(C&)>::type
0278 operator()(C& c) const
0279 {
0280 return c.end();
0281 }
0282 };
0283
0284 namespace result_of
0285 {
0286 template <typename C, typename Arg1, typename Arg2 = mpl::void_>
0287 struct erase
0288 {
0289
0290 typedef
0291 boost::mpl::eval_if<
0292 is_key_type_of<C, Arg1>
0293 , size_type_of<C>
0294 #if defined(BOOST_MSVC) \
0295 && (defined(BOOST_LIBSTDCXX11) && 40500 <= BOOST_LIBSTDCXX_VERSION) \
0296 && defined(_LIBCPP_VERSION)
0297 , iterator_of<C>
0298 #else
0299 , boost::mpl::identity<void>
0300 #endif
0301 >
0302 assoc_erase_result;
0303
0304 typedef typename
0305 boost::mpl::eval_if_c<
0306 has_key_type<C>::value
0307 , assoc_erase_result
0308 , iterator_of<C>
0309 >::type
0310 type;
0311 };
0312 }
0313
0314 struct erase
0315 {
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333 template <typename Sig>
0334 struct result;
0335
0336 template <typename This, typename C, typename Arg1>
0337 struct result<This(C&, Arg1)>
0338 : result_of::erase<C, Arg1>
0339 {};
0340
0341 template <typename This, typename C, typename Arg1, typename Arg2>
0342 struct result<This(C&, Arg1, Arg2)>
0343 : result_of::erase<C, Arg1, Arg2>
0344 {};
0345
0346 template <typename C, typename Arg1>
0347 typename result_of::erase<C, Arg1>::type
0348 operator()(C& c, Arg1 arg1) const
0349 {
0350 typedef typename result_of::erase<C, Arg1>::type result_type;
0351 return static_cast<result_type>(c.erase(arg1));
0352 }
0353
0354 template <typename C, typename Arg1, typename Arg2>
0355 typename result_of::erase<C, Arg1, Arg2>::type
0356 operator()(C& c, Arg1 arg1, Arg2 arg2) const
0357 {
0358 typedef typename result_of::erase<C, Arg1, Arg2>::type result_type;
0359 return static_cast<result_type>(c.erase(arg1, arg2));
0360 }
0361 };
0362
0363 struct front
0364 {
0365 template <typename Sig>
0366 struct result;
0367
0368 template <typename This, typename C>
0369 struct result<This(C&)>
0370 {
0371 typedef typename const_qualified_reference_of<C>::type type;
0372 };
0373
0374 template <typename C>
0375 typename result<front(C&)>::type
0376 operator()(C& c) const
0377 {
0378 return c.front();
0379 }
0380 };
0381
0382 struct get_allocator
0383 {
0384 template <typename Sig>
0385 struct result;
0386
0387 template <typename This, typename C>
0388 struct result<This(C&)>
0389 {
0390 typedef typename allocator_type_of<C>::type type;
0391 };
0392
0393 template <typename C>
0394 typename result<get_allocator(C const&)>::type
0395 operator()(C& c) const
0396 {
0397 return c.get_allocator();
0398 }
0399 };
0400
0401 namespace result_of
0402 {
0403 template <
0404 typename C
0405 , typename Arg1
0406 , typename Arg2 = mpl::void_
0407 , typename Arg3 = mpl::void_
0408 >
0409 class insert
0410 {
0411 struct pair_iterator_bool
0412 {
0413 typedef typename std::pair<typename C::iterator, bool> type;
0414 };
0415
0416 typedef
0417 boost::mpl::eval_if<
0418 map_insert_returns_pair<typename remove_const<C>::type>
0419 , pair_iterator_bool
0420 , iterator_of<C>
0421 >
0422 choice_1;
0423
0424 typedef
0425 boost::mpl::eval_if_c<
0426 boost::mpl::and_<
0427 boost::is_same<Arg3, mpl::void_>
0428 , boost::mpl::not_<boost::is_same<Arg1, Arg2> >
0429 >::value
0430 , iterator_of<C>
0431 , boost::mpl::identity<void>
0432 >
0433 choice_2;
0434
0435 public:
0436
0437 typedef typename
0438 boost::mpl::eval_if_c<
0439 boost::is_same<Arg2, mpl::void_>::value
0440 , choice_1
0441 , choice_2
0442 >::type
0443 type;
0444 };
0445 }
0446
0447 struct insert
0448 {
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471 template <typename Sig>
0472 struct result;
0473
0474 template <
0475 typename This
0476 , typename C
0477 , typename Arg1
0478 >
0479 struct result<This(C &, Arg1)>
0480 : result_of::insert<C, Arg1>
0481 {};
0482
0483 template <
0484 typename This
0485 , typename C
0486 , typename Arg1
0487 , typename Arg2
0488 >
0489 struct result<This(C &, Arg1, Arg2)>
0490 : result_of::insert<C, Arg1, Arg2>
0491 {};
0492
0493 template <
0494 typename This
0495 , typename C
0496 , typename Arg1
0497 , typename Arg2
0498 , typename Arg3
0499 >
0500 struct result<This(C &, Arg1, Arg2, Arg3)>
0501 : result_of::insert<C, Arg1, Arg2, Arg3>
0502 {};
0503
0504 template <typename C, typename Arg1>
0505 typename result<insert(C&, Arg1)>::type
0506 operator()(C& c, Arg1 arg1) const
0507 {
0508 return c.insert(arg1);
0509 }
0510
0511 template <typename C, typename Arg1, typename Arg2>
0512 typename result<insert(C&, Arg1, Arg2)>::type
0513 operator()(C& c, Arg1 arg1, Arg2 arg2) const
0514 {
0515 typedef typename result<insert(C&, Arg1, Arg2)>::type result_type;
0516 return static_cast<result_type>(c.insert(arg1, arg2));
0517 }
0518
0519 template <typename C, typename Arg1, typename Arg2, typename Arg3>
0520 typename result<insert(C&, Arg1, Arg2, Arg3)>::type
0521 operator()(C& c, Arg1 arg1, Arg2 arg2, Arg3 arg3) const
0522 {
0523 typedef typename result<insert(C&, Arg1, Arg2, Arg3)>::type result_type;
0524 return static_cast<result_type>(c.insert(arg1, arg2, arg3));
0525 }
0526 };
0527
0528 namespace result_of
0529 {
0530 template <typename C>
0531 struct key_comp
0532 {
0533 typedef typename key_compare_of<C>::type type;
0534 };
0535 }
0536
0537 struct key_comp
0538 {
0539 template <typename Sig>
0540 struct result;
0541
0542 template <typename This, typename C>
0543 struct result<This(C&)>
0544 : result_of::key_comp<C>
0545 {};
0546
0547 template <typename C>
0548 typename result_of::key_comp<C>::type
0549 operator()(C& c) const
0550 {
0551 return c.key_comp();
0552 }
0553 };
0554
0555 struct max_size
0556 {
0557 template <typename Sig>
0558 struct result;
0559
0560 template <typename This, typename C>
0561 struct result<This(C&)>
0562 {
0563 typedef typename size_type_of<C>::type type;
0564 };
0565
0566 template <typename C>
0567 typename result<max_size(C const&)>::type
0568 operator()(C& c) const
0569 {
0570 return c.max_size();
0571 }
0572 };
0573
0574 struct pop_back
0575 {
0576 typedef void result_type;
0577
0578 template <typename C>
0579 void operator()(C& c) const
0580 {
0581 return c.pop_back();
0582 }
0583 };
0584
0585 struct pop_front
0586 {
0587 typedef void result_type;
0588
0589 template <typename C>
0590 void operator()(C& c) const
0591 {
0592 return c.pop_front();
0593 }
0594 };
0595
0596 struct push_back
0597 {
0598 typedef void result_type;
0599
0600 template <typename C, typename Arg>
0601 void operator()(C& c, Arg const& data) const
0602 {
0603 return c.push_back(data);
0604 }
0605 };
0606
0607 struct push_front
0608 {
0609 typedef void result_type;
0610
0611 template <typename C, typename Arg>
0612 void operator()(C& c, Arg const& data) const
0613 {
0614 return c.push_front(data);
0615 }
0616 };
0617
0618 struct rbegin
0619 {
0620 template <typename Sig>
0621 struct result;
0622
0623 template <typename This, typename C>
0624 struct result<This(C&)>
0625 {
0626 typedef typename
0627 const_qualified_reverse_iterator_of<C>::type
0628 type;
0629 };
0630
0631 template <typename C>
0632 typename result<rbegin(C&)>::type
0633 operator()(C& c) const
0634 {
0635 return c.rbegin();
0636 }
0637 };
0638
0639 struct rend
0640 {
0641 template <typename Sig>
0642 struct result;
0643
0644 template <typename This, typename C>
0645 struct result<This(C&)>
0646 {
0647 typedef typename
0648 const_qualified_reverse_iterator_of<C>::type
0649 type;
0650 };
0651
0652 template <typename C>
0653 typename result<rend(C&)>::type
0654 operator()(C& c) const
0655 {
0656 return c.rend();
0657 }
0658 };
0659
0660 struct reserve
0661 {
0662 typedef void result_type;
0663
0664 template <typename C, typename Arg>
0665 void operator()(C& c, Arg const& count) const
0666 {
0667 c.reserve(count);
0668 }
0669 };
0670
0671 struct resize
0672 {
0673 typedef void result_type;
0674
0675 template <typename C, typename Arg1>
0676 void operator()(C& c, Arg1 const& arg1) const
0677 {
0678 c.resize(arg1);
0679 }
0680
0681 template <typename C, typename Arg1, typename Arg2>
0682 void operator()(C& c, Arg1 const& arg1, Arg2 const& arg2) const
0683 {
0684 c.resize(arg1, arg2);
0685 }
0686 };
0687
0688 struct size
0689 {
0690 template <typename Sig>
0691 struct result;
0692
0693 template <typename This, typename C>
0694 struct result<This(C&)>
0695 {
0696 typedef typename size_type_of<C>::type type;
0697 };
0698
0699 template <typename C>
0700 typename result<size(C&)>::type
0701 operator()(C& c) const
0702 {
0703 return c.size();
0704 }
0705 };
0706
0707 struct splice
0708 {
0709 typedef void result_type;
0710
0711 template <typename C, typename Arg1, typename Arg2>
0712 void operator()(C& c, Arg1 arg1, Arg2 &arg2) const
0713 {
0714 c.splice(arg1, arg2);
0715 }
0716
0717 template <
0718 typename C
0719 , typename Arg1
0720 , typename Arg2
0721 , typename Arg3
0722 >
0723 void operator()(
0724 C& c
0725 , Arg1 arg1
0726 , Arg2 & arg2
0727 , Arg3 arg3
0728 ) const
0729 {
0730 c.splice(arg1, arg2, arg3);
0731 }
0732
0733 template <
0734 typename C
0735 , typename Arg1
0736 , typename Arg2
0737 , typename Arg3
0738 , typename Arg4
0739 >
0740 void operator()(
0741 C c
0742 , Arg1 arg1
0743 , Arg2 & arg2
0744 , Arg3 arg3
0745 , Arg4 arg4
0746 ) const
0747 {
0748 c.splice(arg1, arg2, arg3, arg4);
0749 }
0750 };
0751
0752
0753 namespace result_of
0754 {
0755 template <typename C>
0756 struct value_comp
0757 {
0758 typedef typename value_compare_of<C>::type type;
0759 };
0760 }
0761
0762 struct value_comp
0763 {
0764 template <typename Sig>
0765 struct result;
0766
0767 template <typename This, typename C>
0768 struct result<This(C&)>
0769 : result_of::value_comp<C>
0770 {};
0771
0772 template <typename C>
0773 typename result_of::value_comp<C>::type
0774 operator()(C& c) const
0775 {
0776 return c.value_comp();
0777 }
0778 };
0779
0780 }
0781
0782
0783
0784
0785
0786
0787 namespace adl_barrier
0788 {
0789 BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 2)
0790 BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 3)
0791 BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 4)
0792 BOOST_PHOENIX_ADAPT_CALLABLE(at, ::boost::phoenix::stl::at_impl, 2)
0793 BOOST_PHOENIX_ADAPT_CALLABLE(back, stl::back, 1)
0794 BOOST_PHOENIX_ADAPT_CALLABLE(begin, stl::begin, 1)
0795 BOOST_PHOENIX_ADAPT_CALLABLE(capacity, stl::capacity, 1)
0796 BOOST_PHOENIX_ADAPT_CALLABLE(clear, stl::clear, 1)
0797 BOOST_PHOENIX_ADAPT_CALLABLE(empty, stl::empty, 1)
0798 BOOST_PHOENIX_ADAPT_CALLABLE(end, stl::end, 1)
0799 BOOST_PHOENIX_ADAPT_CALLABLE(erase, stl::erase, 2)
0800 BOOST_PHOENIX_ADAPT_CALLABLE(erase, stl::erase, 3)
0801 BOOST_PHOENIX_ADAPT_CALLABLE(front, stl::front, 1)
0802 BOOST_PHOENIX_ADAPT_CALLABLE(get_allocator, stl::get_allocator, 1)
0803 BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 2)
0804 BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 3)
0805 BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 4)
0806 BOOST_PHOENIX_ADAPT_CALLABLE(key_comp, stl::key_comp, 1)
0807 BOOST_PHOENIX_ADAPT_CALLABLE(max_size, stl::max_size, 1)
0808 BOOST_PHOENIX_ADAPT_CALLABLE(pop_back, stl::pop_back, 1)
0809 BOOST_PHOENIX_ADAPT_CALLABLE(pop_front, stl::pop_front, 1)
0810 BOOST_PHOENIX_ADAPT_CALLABLE(push_back, stl::push_back, 2)
0811 BOOST_PHOENIX_ADAPT_CALLABLE(push_front, stl::push_front, 2)
0812 BOOST_PHOENIX_ADAPT_CALLABLE(rbegin, stl::rbegin, 1)
0813 BOOST_PHOENIX_ADAPT_CALLABLE(rend, stl::rend, 1)
0814 BOOST_PHOENIX_ADAPT_CALLABLE(reserve, stl::reserve, 2)
0815 BOOST_PHOENIX_ADAPT_CALLABLE(resize, stl::resize, 2)
0816 BOOST_PHOENIX_ADAPT_CALLABLE(resize, stl::resize, 3)
0817 BOOST_PHOENIX_ADAPT_CALLABLE(size, stl::size, 1)
0818 BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 2)
0819 BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 3)
0820 BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 4)
0821 BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 5)
0822 BOOST_PHOENIX_ADAPT_CALLABLE(value_comp, stl::value_comp, 1)
0823 }
0824
0825 using namespace phoenix::adl_barrier;
0826 }}
0827
0828 #endif