the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 1128 lines 46 kB view raw
1/////////////////////////////////////////////////////////////////////////////// 2// foreach.hpp header file 3// 4// Copyright 2004 Eric Niebler. 5// Distributed under the Boost Software License, Version 1.0. (See 6// accompanying file LICENSE_1_0.txt or copy at 7// http://www.boost.org/LICENSE_1_0.txt) 8// See http://www.boost.org/libs/foreach for documentation 9// 10// Credits: 11// Anson Tsao - for the initial inspiration and several good suggestions. 12// Thorsten Ottosen - for Boost.Range, and for suggesting a way to detect 13// const-qualified rvalues at compile time on VC7.1+ 14// Russell Hind - For help porting to Borland 15// Alisdair Meredith - For help porting to Borland 16// Stefan Slapeta - For help porting to Intel 17// David Jenkins - For help finding a Microsoft Code Analysis bug 18// mimomorin@... - For a patch to use rvalue refs on supporting compilers 19 20#ifndef BOOST_FOREACH 21 22// MS compatible compilers support #pragma once 23#if defined(_MSC_VER) && (_MSC_VER >= 1020) 24# pragma once 25#endif 26 27#include <cstddef> 28#include <utility> // for std::pair 29 30#include <boost/config.hpp> 31#include <boost/detail/workaround.hpp> 32 33// Some compilers let us detect even const-qualified rvalues at compile-time 34#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ 35 || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ 36 || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \ 37 !defined(BOOST_CLANG)) \ 38 || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \ 39 !defined(BOOST_CLANG)) 40# define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION 41#else 42// Some compilers allow temporaries to be bound to non-const references. 43// These compilers make it impossible to for BOOST_FOREACH to detect 44// temporaries and avoid reevaluation of the collection expression. 45# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ 46 || BOOST_WORKAROUND(__BORLANDC__, < 0x593) \ 47 || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ 48 || BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) \ 49 || BOOST_WORKAROUND(__DECCXX_VER, <= 60590042) 50# define BOOST_FOREACH_NO_RVALUE_DETECTION 51# endif 52// Some compilers do not correctly implement the lvalue/rvalue conversion 53// rules of the ternary conditional operator. 54# if defined(BOOST_FOREACH_NO_RVALUE_DETECTION) \ 55 || defined(BOOST_NO_SFINAE) \ 56 || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ 57 || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1400)) \ 58 || BOOST_WORKAROUND(__GNUC__, < 3) \ 59 || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 2)) \ 60 || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 3) && defined(__APPLE_CC__)) \ 61 || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ 62 || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) \ 63 || BOOST_WORKAROUND(__SUNPRO_CC, >= 0x5100) \ 64 || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) 65# define BOOST_FOREACH_NO_CONST_RVALUE_DETECTION 66# else 67# define BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 68# endif 69#endif 70 71#include <boost/mpl/if.hpp> 72#include <boost/mpl/assert.hpp> 73#include <boost/mpl/logical.hpp> 74#include <boost/mpl/eval_if.hpp> 75#include <boost/noncopyable.hpp> 76#include <boost/range/end.hpp> 77#include <boost/range/begin.hpp> 78#include <boost/range/rend.hpp> 79#include <boost/range/rbegin.hpp> 80#include <boost/range/iterator.hpp> 81#include <boost/range/reverse_iterator.hpp> 82#include <boost/type_traits/is_array.hpp> 83#include <boost/type_traits/is_const.hpp> 84#include <boost/type_traits/is_abstract.hpp> 85#include <boost/type_traits/is_base_and_derived.hpp> 86#include <boost/type_traits/is_rvalue_reference.hpp> 87#include <boost/iterator/iterator_traits.hpp> 88#include <boost/utility/addressof.hpp> 89#include <boost/foreach_fwd.hpp> 90 91#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 92# include <new> 93# include <boost/aligned_storage.hpp> 94# include <boost/utility/enable_if.hpp> 95# include <boost/type_traits/remove_const.hpp> 96#endif 97 98namespace boost 99{ 100 101// forward declarations for iterator_range 102template<typename T> 103class iterator_range; 104 105// forward declarations for sub_range 106template<typename T> 107class sub_range; 108 109namespace foreach 110{ 111 /////////////////////////////////////////////////////////////////////////////// 112 // in_range 113 // 114 template<typename T> 115 inline std::pair<T, T> in_range(T begin, T end) 116 { 117 return std::make_pair(begin, end); 118 } 119 120 /////////////////////////////////////////////////////////////////////////////// 121 // boost::foreach::is_lightweight_proxy 122 // Specialize this for user-defined collection types if they are inexpensive to copy. 123 // This tells BOOST_FOREACH it can avoid the rvalue/lvalue detection stuff. 124 template<typename T> 125 struct is_lightweight_proxy 126 : boost::mpl::false_ 127 { 128 }; 129 130 /////////////////////////////////////////////////////////////////////////////// 131 // boost::foreach::is_noncopyable 132 // Specialize this for user-defined collection types if they cannot be copied. 133 // This also tells BOOST_FOREACH to avoid the rvalue/lvalue detection stuff. 134 template<typename T> 135 struct is_noncopyable 136 #if !defined(BOOST_BROKEN_IS_BASE_AND_DERIVED) && !defined(BOOST_NO_IS_ABSTRACT) 137 : boost::mpl::or_< 138 boost::is_abstract<T> 139 , boost::is_base_and_derived<boost::noncopyable, T> 140 > 141 #elif !defined(BOOST_BROKEN_IS_BASE_AND_DERIVED) 142 : boost::is_base_and_derived<boost::noncopyable, T> 143 #elif !defined(BOOST_NO_IS_ABSTRACT) 144 : boost::is_abstract<T> 145 #else 146 : boost::mpl::false_ 147 #endif 148 { 149 }; 150 151} // namespace foreach 152 153} // namespace boost 154 155// vc6/7 needs help ordering the following overloads 156#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 157# define BOOST_FOREACH_TAG_DEFAULT ... 158#else 159# define BOOST_FOREACH_TAG_DEFAULT boost::foreach::tag 160#endif 161 162/////////////////////////////////////////////////////////////////////////////// 163// boost_foreach_is_lightweight_proxy 164// Another customization point for the is_lightweight_proxy optimization, 165// this one works on legacy compilers. Overload boost_foreach_is_lightweight_proxy 166// at the global namespace for your type. 167template<typename T> 168inline boost::foreach::is_lightweight_proxy<T> * 169boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } 170 171template<typename T> 172inline boost::mpl::true_ * 173boost_foreach_is_lightweight_proxy(std::pair<T, T> *&, boost::foreach::tag) { return 0; } 174 175template<typename T> 176inline boost::mpl::true_ * 177boost_foreach_is_lightweight_proxy(boost::iterator_range<T> *&, boost::foreach::tag) { return 0; } 178 179template<typename T> 180inline boost::mpl::true_ * 181boost_foreach_is_lightweight_proxy(boost::sub_range<T> *&, boost::foreach::tag) { return 0; } 182 183template<typename T> 184inline boost::mpl::true_ * 185boost_foreach_is_lightweight_proxy(T **&, boost::foreach::tag) { return 0; } 186 187/////////////////////////////////////////////////////////////////////////////// 188// boost_foreach_is_noncopyable 189// Another customization point for the is_noncopyable trait, 190// this one works on legacy compilers. Overload boost_foreach_is_noncopyable 191// at the global namespace for your type. 192template<typename T> 193inline boost::foreach::is_noncopyable<T> * 194boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } 195 196namespace boost 197{ 198 199namespace foreach_detail_ 200{ 201 202/////////////////////////////////////////////////////////////////////////////// 203// Define some utilities for assessing the properties of expressions 204// 205template<typename Bool1, typename Bool2> 206inline boost::mpl::and_<Bool1, Bool2> *and_(Bool1 *, Bool2 *) { return 0; } 207 208template<typename Bool1, typename Bool2, typename Bool3> 209inline boost::mpl::and_<Bool1, Bool2, Bool3> *and_(Bool1 *, Bool2 *, Bool3 *) { return 0; } 210 211template<typename Bool1, typename Bool2> 212inline boost::mpl::or_<Bool1, Bool2> *or_(Bool1 *, Bool2 *) { return 0; } 213 214template<typename Bool1, typename Bool2, typename Bool3> 215inline boost::mpl::or_<Bool1, Bool2, Bool3> *or_(Bool1 *, Bool2 *, Bool3 *) { return 0; } 216 217template<typename Bool1> 218inline boost::mpl::not_<Bool1> *not_(Bool1 *) { return 0; } 219 220template<typename T> 221inline boost::is_array<T> *is_array_(T const &) { return 0; } 222 223template<typename T> 224inline boost::is_const<T> *is_const_(T &) { return 0; } 225 226#ifndef BOOST_FOREACH_NO_RVALUE_DETECTION 227template<typename T> 228inline boost::mpl::true_ *is_const_(T const &) { return 0; } 229#endif 230 231#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES 232template<typename T> 233inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } 234 235template<typename T> 236inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } 237#else 238template<typename T> 239inline boost::is_rvalue_reference<T &&> *is_rvalue_(T &&, int) { return 0; } 240#endif 241 242/////////////////////////////////////////////////////////////////////////////// 243// auto_any_t/auto_any 244// General utility for putting an object of any type into automatic storage 245struct auto_any_base 246{ 247 // auto_any_base must evaluate to false in boolean context so that 248 // they can be declared in if() statements. 249 operator bool() const 250 { 251 return false; 252 } 253}; 254 255template<typename T> 256struct auto_any : auto_any_base 257{ 258 explicit auto_any(T const &t) 259 : item(t) 260 { 261 } 262 263 // temporaries of type auto_any will be bound to const auto_any_base 264 // references, but we still want to be able to mutate the stored 265 // data, so declare it as mutable. 266 mutable T item; 267}; 268 269typedef auto_any_base const &auto_any_t; 270 271template<typename T, typename C> 272inline BOOST_DEDUCED_TYPENAME boost::mpl::if_<C, T const, T>::type &auto_any_cast(auto_any_t a) 273{ 274 return static_cast<auto_any<T> const &>(a).item; 275} 276 277typedef boost::mpl::true_ const_; 278 279/////////////////////////////////////////////////////////////////////////////// 280// type2type 281// 282template<typename T, typename C = boost::mpl::false_> 283struct type2type 284 : boost::mpl::if_<C, T const, T> 285{ 286}; 287 288template<typename T> 289struct wrap_cstr 290{ 291 typedef T type; 292}; 293 294template<> 295struct wrap_cstr<char *> 296{ 297 typedef wrap_cstr<char *> type; 298 typedef char *iterator; 299 typedef char *const_iterator; 300}; 301 302template<> 303struct wrap_cstr<char const *> 304{ 305 typedef wrap_cstr<char const *> type; 306 typedef char const *iterator; 307 typedef char const *const_iterator; 308}; 309 310template<> 311struct wrap_cstr<wchar_t *> 312{ 313 typedef wrap_cstr<wchar_t *> type; 314 typedef wchar_t *iterator; 315 typedef wchar_t *const_iterator; 316}; 317 318template<> 319struct wrap_cstr<wchar_t const *> 320{ 321 typedef wrap_cstr<wchar_t const *> type; 322 typedef wchar_t const *iterator; 323 typedef wchar_t const *const_iterator; 324}; 325 326template<typename T> 327struct is_char_array 328 : mpl::and_< 329 is_array<T> 330 , mpl::or_< 331 is_convertible<T, char const *> 332 , is_convertible<T, wchar_t const *> 333 > 334 > 335{}; 336 337template<typename T, typename C = boost::mpl::false_> 338struct foreach_iterator 339{ 340 // **** READ THIS IF YOUR COMPILE BREAKS HERE **** 341 // 342 // There is an ambiguity about how to iterate over arrays of char and wchar_t. 343 // Should the last array element be treated as a null terminator to be skipped, or 344 // is it just like any other element in the array? To fix the problem, you must 345 // say which behavior you want. 346 // 347 // To treat the container as a null-terminated string, merely cast it to a 348 // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... 349 // 350 // To treat the container as an array, use boost::as_array() in <boost/range/as_array.hpp>, 351 // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... 352 #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 353 BOOST_MPL_ASSERT_MSG( (!is_char_array<T>::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); 354 #endif 355 356 // If the type is a pointer to a null terminated string (as opposed 357 // to an array type), there is no ambiguity. 358 typedef BOOST_DEDUCED_TYPENAME wrap_cstr<T>::type container; 359 360 typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< 361 C 362 , range_const_iterator<container> 363 , range_mutable_iterator<container> 364 >::type type; 365}; 366 367 368template<typename T, typename C = boost::mpl::false_> 369struct foreach_reverse_iterator 370{ 371 // **** READ THIS IF YOUR COMPILE BREAKS HERE **** 372 // 373 // There is an ambiguity about how to iterate over arrays of char and wchar_t. 374 // Should the last array element be treated as a null terminator to be skipped, or 375 // is it just like any other element in the array? To fix the problem, you must 376 // say which behavior you want. 377 // 378 // To treat the container as a null-terminated string, merely cast it to a 379 // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... 380 // 381 // To treat the container as an array, use boost::as_array() in <boost/range/as_array.hpp>, 382 // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... 383 #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 384 BOOST_MPL_ASSERT_MSG( (!is_char_array<T>::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); 385 #endif 386 387 // If the type is a pointer to a null terminated string (as opposed 388 // to an array type), there is no ambiguity. 389 typedef BOOST_DEDUCED_TYPENAME wrap_cstr<T>::type container; 390 391 typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< 392 C 393 , range_reverse_iterator<container const> 394 , range_reverse_iterator<container> 395 >::type type; 396}; 397 398template<typename T, typename C = boost::mpl::false_> 399struct foreach_reference 400 : iterator_reference<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> 401{ 402}; 403 404/////////////////////////////////////////////////////////////////////////////// 405// encode_type 406// 407template<typename T> 408inline type2type<T> *encode_type(T &, boost::mpl::false_ *) { return 0; } 409 410template<typename T> 411inline type2type<T, const_> *encode_type(T const &, boost::mpl::true_ *) { return 0; } 412 413/////////////////////////////////////////////////////////////////////////////// 414// set_false 415// 416inline bool set_false(bool &b) 417{ 418 b = false; 419 return false; 420} 421 422/////////////////////////////////////////////////////////////////////////////// 423// to_ptr 424// 425template<typename T> 426inline T *&to_ptr(T const &) 427{ 428 static T *t = 0; 429 return t; 430} 431 432// Borland needs a little extra help with arrays 433#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 434template<typename T,std::size_t N> 435inline T (*&to_ptr(T (&)[N]))[N] 436{ 437 static T (*t)[N] = 0; 438 return t; 439} 440 441/////////////////////////////////////////////////////////////////////////////// 442// derefof 443// 444template<typename T> 445inline T &derefof(T *t) 446{ 447 // This is a work-around for a compiler bug in Borland. If T* is a pointer to array type U(*)[N], 448 // then dereferencing it results in a U* instead of U(&)[N]. The cast forces the issue. 449 return reinterpret_cast<T &>( 450 *const_cast<char *>( 451 reinterpret_cast<char const volatile *>(t) 452 ) 453 ); 454} 455 456# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T) 457#else 458# define BOOST_FOREACH_DEREFOF(T) (*T) 459#endif 460 461#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ 462 && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 463/////////////////////////////////////////////////////////////////////////////// 464// Rvalue references makes it drop-dead simple to detect at compile time 465// whether an expression is an rvalue. 466/////////////////////////////////////////////////////////////////////////////// 467 468# define BOOST_FOREACH_IS_RVALUE(COL) \ 469 boost::foreach_detail_::is_rvalue_((COL), 0) 470 471#elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ 472 && defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 473/////////////////////////////////////////////////////////////////////////////// 474// Detect at compile-time whether an expression yields an rvalue or 475// an lvalue. This is rather non-standard, but some popular compilers 476// accept it. 477/////////////////////////////////////////////////////////////////////////////// 478 479/////////////////////////////////////////////////////////////////////////////// 480// rvalue_probe 481// 482template<typename T> 483struct rvalue_probe 484{ 485 struct private_type_ {}; 486 // can't ever return an array by value 487 typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< 488 boost::mpl::or_<boost::is_abstract<T>, boost::is_array<T> >, private_type_, T 489 >::type value_type; 490 operator value_type() { return *reinterpret_cast<value_type *>(this); } // never called 491 operator T &() const { return *reinterpret_cast<T *>(const_cast<rvalue_probe *>(this)); } // never called 492}; 493 494template<typename T> 495rvalue_probe<T> const make_probe(T const &) 496{ 497 return rvalue_probe<T>(); 498} 499 500# define BOOST_FOREACH_IS_RVALUE(COL) \ 501 boost::foreach_detail_::and_( \ 502 boost::foreach_detail_::not_(boost::foreach_detail_::is_array_(COL)) \ 503 , (true ? 0 : boost::foreach_detail_::is_rvalue_( \ 504 (true ? boost::foreach_detail_::make_probe(COL) : (COL)), 0))) 505 506#elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) 507/////////////////////////////////////////////////////////////////////////////// 508// Detect at run-time whether an expression yields an rvalue 509// or an lvalue. This is 100% standard C++, but not all compilers 510// accept it. Also, it causes FOREACH to break when used with non- 511// copyable collection types. 512/////////////////////////////////////////////////////////////////////////////// 513 514/////////////////////////////////////////////////////////////////////////////// 515// rvalue_probe 516// 517template<typename T> 518struct rvalue_probe 519{ 520 rvalue_probe(T &t, bool &b) 521 : value(t) 522 , is_rvalue(b) 523 { 524 } 525 526 struct private_type_ {}; 527 // can't ever return an array or an abstract type by value 528 #ifdef BOOST_NO_IS_ABSTRACT 529 typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< 530 boost::is_array<T>, private_type_, T 531 >::type value_type; 532 #else 533 typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< 534 boost::mpl::or_<boost::is_abstract<T>, boost::is_array<T> >, private_type_, T 535 >::type value_type; 536 #endif 537 538 operator value_type() 539 { 540 this->is_rvalue = true; 541 return this->value; 542 } 543 544 operator T &() const 545 { 546 return this->value; 547 } 548 549private: 550 T &value; 551 bool &is_rvalue; 552}; 553 554template<typename T> 555rvalue_probe<T> make_probe(T &t, bool &b) { return rvalue_probe<T>(t, b); } 556 557template<typename T> 558rvalue_probe<T const> make_probe(T const &t, bool &b) { return rvalue_probe<T const>(t, b); } 559 560/////////////////////////////////////////////////////////////////////////////// 561// simple_variant 562// holds either a T or a T const* 563template<typename T> 564struct simple_variant 565{ 566 simple_variant(T const *t) 567 : is_rvalue(false) 568 { 569 *static_cast<T const **>(this->data.address()) = t; 570 } 571 572 simple_variant(T const &t) 573 : is_rvalue(true) 574 { 575 ::new(this->data.address()) T(t); 576 } 577 578 simple_variant(simple_variant const &that) 579 : is_rvalue(that.is_rvalue) 580 { 581 if(this->is_rvalue) 582 ::new(this->data.address()) T(*that.get()); 583 else 584 *static_cast<T const **>(this->data.address()) = that.get(); 585 } 586 587 ~simple_variant() 588 { 589 if(this->is_rvalue) 590 this->get()->~T(); 591 } 592 593 T const *get() const 594 { 595 if(this->is_rvalue) 596 return static_cast<T const *>(this->data.address()); 597 else 598 return *static_cast<T const * const *>(this->data.address()); 599 } 600 601private: 602 enum size_type { size = sizeof(T) > sizeof(T*) ? sizeof(T) : sizeof(T*) }; 603 simple_variant &operator =(simple_variant const &); 604 bool const is_rvalue; 605 aligned_storage<size> data; 606}; 607 608// If the collection is an array or is noncopyable, it must be an lvalue. 609// If the collection is a lightweight proxy, treat it as an rvalue 610// BUGBUG what about a noncopyable proxy? 611template<typename LValue, typename IsProxy> 612inline BOOST_DEDUCED_TYPENAME boost::enable_if<boost::mpl::or_<LValue, IsProxy>, IsProxy>::type * 613should_copy_impl(LValue *, IsProxy *, bool *) 614{ 615 return 0; 616} 617 618// Otherwise, we must determine at runtime whether it's an lvalue or rvalue 619inline bool * 620should_copy_impl(boost::mpl::false_ *, boost::mpl::false_ *, bool *is_rvalue) 621{ 622 return is_rvalue; 623} 624 625#endif 626 627/////////////////////////////////////////////////////////////////////////////// 628// contain 629// 630template<typename T> 631inline auto_any<T> contain(T const &t, boost::mpl::true_ *) // rvalue 632{ 633 return auto_any<T>(t); 634} 635 636template<typename T> 637inline auto_any<T *> contain(T &t, boost::mpl::false_ *) // lvalue 638{ 639 // Cannot seem to get sunpro to handle addressof() with array types. 640 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570)) 641 return auto_any<T *>(&t); 642 #else 643 return auto_any<T *>(boost::addressof(t)); 644 #endif 645} 646 647#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 648template<typename T> 649inline auto_any<simple_variant<T> > 650contain(T const &t, bool *rvalue) 651{ 652 return auto_any<simple_variant<T> >(*rvalue ? simple_variant<T>(t) : simple_variant<T>(&t)); 653} 654#endif 655 656///////////////////////////////////////////////////////////////////////////// 657// begin 658// 659template<typename T, typename C> 660inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> 661begin(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue 662{ 663 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( 664 boost::begin(auto_any_cast<T, C>(col))); 665} 666 667template<typename T, typename C> 668inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> 669begin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue 670{ 671 typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; 672 typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; 673 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( 674 iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); 675} 676 677#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 678template<typename T> 679inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type> 680begin(auto_any_t col, type2type<T, const_> *, bool *) 681{ 682 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>( 683 boost::begin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get())); 684} 685#endif 686 687#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 688template<typename T, typename C> 689inline auto_any<T *> 690begin(auto_any_t col, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings 691{ 692 return auto_any<T *>(auto_any_cast<T *, boost::mpl::false_>(col)); 693} 694#endif 695 696/////////////////////////////////////////////////////////////////////////////// 697// end 698// 699template<typename T, typename C> 700inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> 701end(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue 702{ 703 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( 704 boost::end(auto_any_cast<T, C>(col))); 705} 706 707template<typename T, typename C> 708inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> 709end(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue 710{ 711 typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; 712 typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; 713 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( 714 iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); 715} 716 717#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 718template<typename T> 719inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type> 720end(auto_any_t col, type2type<T, const_> *, bool *) 721{ 722 return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>( 723 boost::end(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get())); 724} 725#endif 726 727#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 728template<typename T, typename C> 729inline auto_any<int> 730end(auto_any_t, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings 731{ 732 return auto_any<int>(0); // not used 733} 734#endif 735 736/////////////////////////////////////////////////////////////////////////////// 737// done 738// 739template<typename T, typename C> 740inline bool done(auto_any_t cur, auto_any_t end, type2type<T, C> *) 741{ 742 typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iter_t; 743 return auto_any_cast<iter_t, boost::mpl::false_>(cur) == auto_any_cast<iter_t, boost::mpl::false_>(end); 744} 745 746#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 747template<typename T, typename C> 748inline bool done(auto_any_t cur, auto_any_t, type2type<T *, C> *) // null-terminated C-style strings 749{ 750 return ! *auto_any_cast<T *, boost::mpl::false_>(cur); 751} 752#endif 753 754/////////////////////////////////////////////////////////////////////////////// 755// next 756// 757template<typename T, typename C> 758inline void next(auto_any_t cur, type2type<T, C> *) 759{ 760 typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iter_t; 761 ++auto_any_cast<iter_t, boost::mpl::false_>(cur); 762} 763 764/////////////////////////////////////////////////////////////////////////////// 765// deref 766// 767template<typename T, typename C> 768inline BOOST_DEDUCED_TYPENAME foreach_reference<T, C>::type 769deref(auto_any_t cur, type2type<T, C> *) 770{ 771 typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iter_t; 772 return *auto_any_cast<iter_t, boost::mpl::false_>(cur); 773} 774 775///////////////////////////////////////////////////////////////////////////// 776// rbegin 777// 778template<typename T, typename C> 779inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type> 780rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue 781{ 782 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( 783 boost::rbegin(auto_any_cast<T, C>(col))); 784} 785 786template<typename T, typename C> 787inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type> 788rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue 789{ 790 typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; 791 typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; 792 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( 793 iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); 794} 795 796#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 797template<typename T> 798inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type> 799rbegin(auto_any_t col, type2type<T, const_> *, bool *) 800{ 801 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>( 802 boost::rbegin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get())); 803} 804#endif 805 806#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 807template<typename T, typename C> 808inline auto_any<reverse_iterator<T *> > 809rbegin(auto_any_t col, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings 810{ 811 T *p = auto_any_cast<T *, boost::mpl::false_>(col); 812 while(0 != *p) 813 ++p; 814 return auto_any<reverse_iterator<T *> >(reverse_iterator<T *>(p)); 815} 816#endif 817 818/////////////////////////////////////////////////////////////////////////////// 819// rend 820// 821template<typename T, typename C> 822inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type> 823rend(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue 824{ 825 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( 826 boost::rend(auto_any_cast<T, C>(col))); 827} 828 829template<typename T, typename C> 830inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type> 831rend(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue 832{ 833 typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; 834 typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; 835 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( 836 iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); 837} 838 839#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION 840template<typename T> 841inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type> 842rend(auto_any_t col, type2type<T, const_> *, bool *) 843{ 844 return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>( 845 boost::rend(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get())); 846} 847#endif 848 849#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING 850template<typename T, typename C> 851inline auto_any<reverse_iterator<T *> > 852rend(auto_any_t col, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings 853{ 854 return auto_any<reverse_iterator<T *> >( 855 reverse_iterator<T *>(auto_any_cast<T *, boost::mpl::false_>(col))); 856} 857#endif 858 859/////////////////////////////////////////////////////////////////////////////// 860// rdone 861// 862template<typename T, typename C> 863inline bool rdone(auto_any_t cur, auto_any_t end, type2type<T, C> *) 864{ 865 typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iter_t; 866 return auto_any_cast<iter_t, boost::mpl::false_>(cur) == auto_any_cast<iter_t, boost::mpl::false_>(end); 867} 868 869/////////////////////////////////////////////////////////////////////////////// 870// rnext 871// 872template<typename T, typename C> 873inline void rnext(auto_any_t cur, type2type<T, C> *) 874{ 875 typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iter_t; 876 ++auto_any_cast<iter_t, boost::mpl::false_>(cur); 877} 878 879/////////////////////////////////////////////////////////////////////////////// 880// rderef 881// 882template<typename T, typename C> 883inline BOOST_DEDUCED_TYPENAME foreach_reference<T, C>::type 884rderef(auto_any_t cur, type2type<T, C> *) 885{ 886 typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iter_t; 887 return *auto_any_cast<iter_t, boost::mpl::false_>(cur); 888} 889 890} // namespace foreach_detail_ 891} // namespace boost 892 893// Suppress a bogus code analysis warning on vc8+ 894#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) 895# define BOOST_FOREACH_SUPPRESS_WARNINGS() __pragma(warning(suppress:6001)) 896#else 897# define BOOST_FOREACH_SUPPRESS_WARNINGS() 898#endif 899 900/////////////////////////////////////////////////////////////////////////////// 901// Define a macro for giving hidden variables a unique name. Not strictly 902// needed, but eliminates some warnings on some compilers. 903#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) 904// With some versions of MSVC, use of __LINE__ to create unique identifiers 905// can fail when the Edit-and-Continue debug flag is used. 906# define BOOST_FOREACH_ID(x) x 907#else 908# define BOOST_FOREACH_ID(x) BOOST_PP_CAT(x, __LINE__) 909#endif 910 911// A sneaky way to get the type of the collection without evaluating the expression 912#define BOOST_FOREACH_TYPEOF(COL) \ 913 (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL))) 914 915// returns true_* if the type is noncopyable 916#define BOOST_FOREACH_IS_NONCOPYABLE(COL) \ 917 boost_foreach_is_noncopyable( \ 918 boost::foreach_detail_::to_ptr(COL) \ 919 , boost_foreach_argument_dependent_lookup_hack_value) 920 921// returns true_* if the type is a lightweight proxy (and is not noncopyable) 922#define BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \ 923 boost::foreach_detail_::and_( \ 924 boost::foreach_detail_::not_(BOOST_FOREACH_IS_NONCOPYABLE(COL)) \ 925 , boost_foreach_is_lightweight_proxy( \ 926 boost::foreach_detail_::to_ptr(COL) \ 927 , boost_foreach_argument_dependent_lookup_hack_value)) 928 929#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) 930/////////////////////////////////////////////////////////////////////////////// 931// R-values and const R-values supported here with zero runtime overhead 932/////////////////////////////////////////////////////////////////////////////// 933 934// No variable is needed to track the rvalue-ness of the collection expression 935# define BOOST_FOREACH_PREAMBLE() \ 936 BOOST_FOREACH_SUPPRESS_WARNINGS() 937 938// Evaluate the collection expression 939# define BOOST_FOREACH_EVALUATE(COL) \ 940 (COL) 941 942# define BOOST_FOREACH_SHOULD_COPY(COL) \ 943 (true ? 0 : boost::foreach_detail_::or_( \ 944 BOOST_FOREACH_IS_RVALUE(COL) \ 945 , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) 946 947#elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) 948/////////////////////////////////////////////////////////////////////////////// 949// R-values and const R-values supported here 950/////////////////////////////////////////////////////////////////////////////// 951 952// Declare a variable to track the rvalue-ness of the collection expression 953# define BOOST_FOREACH_PREAMBLE() \ 954 BOOST_FOREACH_SUPPRESS_WARNINGS() \ 955 if (bool BOOST_FOREACH_ID(_foreach_is_rvalue) = false) {} else 956 957// Evaluate the collection expression, and detect if it is an lvalue or and rvalue 958# define BOOST_FOREACH_EVALUATE(COL) \ 959 (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL)) 960 961// The rvalue/lvalue-ness of the collection expression is determined dynamically, unless 962// the type is an array or is noncopyable or is non-const, in which case we know it's an lvalue. 963// If the type happens to be a lightweight proxy, always make a copy. 964# define BOOST_FOREACH_SHOULD_COPY(COL) \ 965 (boost::foreach_detail_::should_copy_impl( \ 966 true ? 0 : boost::foreach_detail_::or_( \ 967 boost::foreach_detail_::is_array_(COL) \ 968 , BOOST_FOREACH_IS_NONCOPYABLE(COL) \ 969 , boost::foreach_detail_::not_(boost::foreach_detail_::is_const_(COL))) \ 970 , true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \ 971 , &BOOST_FOREACH_ID(_foreach_is_rvalue))) 972 973#elif !defined(BOOST_FOREACH_NO_RVALUE_DETECTION) 974/////////////////////////////////////////////////////////////////////////////// 975// R-values supported here, const R-values NOT supported here 976/////////////////////////////////////////////////////////////////////////////// 977 978// No variable is needed to track the rvalue-ness of the collection expression 979# define BOOST_FOREACH_PREAMBLE() \ 980 BOOST_FOREACH_SUPPRESS_WARNINGS() 981 982// Evaluate the collection expression 983# define BOOST_FOREACH_EVALUATE(COL) \ 984 (COL) 985 986// Determine whether the collection expression is an lvalue or an rvalue. 987// NOTE: this gets the answer wrong for const rvalues. 988# define BOOST_FOREACH_SHOULD_COPY(COL) \ 989 (true ? 0 : boost::foreach_detail_::or_( \ 990 boost::foreach_detail_::is_rvalue_((COL), 0) \ 991 , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) 992 993#else 994/////////////////////////////////////////////////////////////////////////////// 995// R-values NOT supported here 996/////////////////////////////////////////////////////////////////////////////// 997 998// No variable is needed to track the rvalue-ness of the collection expression 999# define BOOST_FOREACH_PREAMBLE() \ 1000 BOOST_FOREACH_SUPPRESS_WARNINGS() 1001 1002// Evaluate the collection expression 1003# define BOOST_FOREACH_EVALUATE(COL) \ 1004 (COL) 1005 1006// Can't use rvalues with BOOST_FOREACH (unless they are lightweight proxies) 1007# define BOOST_FOREACH_SHOULD_COPY(COL) \ 1008 (true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL)) 1009 1010#endif 1011 1012#define BOOST_FOREACH_CONTAIN(COL) \ 1013 boost::foreach_detail_::contain( \ 1014 BOOST_FOREACH_EVALUATE(COL) \ 1015 , BOOST_FOREACH_SHOULD_COPY(COL)) 1016 1017#define BOOST_FOREACH_BEGIN(COL) \ 1018 boost::foreach_detail_::begin( \ 1019 BOOST_FOREACH_ID(_foreach_col) \ 1020 , BOOST_FOREACH_TYPEOF(COL) \ 1021 , BOOST_FOREACH_SHOULD_COPY(COL)) 1022 1023#define BOOST_FOREACH_END(COL) \ 1024 boost::foreach_detail_::end( \ 1025 BOOST_FOREACH_ID(_foreach_col) \ 1026 , BOOST_FOREACH_TYPEOF(COL) \ 1027 , BOOST_FOREACH_SHOULD_COPY(COL)) 1028 1029#define BOOST_FOREACH_DONE(COL) \ 1030 boost::foreach_detail_::done( \ 1031 BOOST_FOREACH_ID(_foreach_cur) \ 1032 , BOOST_FOREACH_ID(_foreach_end) \ 1033 , BOOST_FOREACH_TYPEOF(COL)) 1034 1035#define BOOST_FOREACH_NEXT(COL) \ 1036 boost::foreach_detail_::next( \ 1037 BOOST_FOREACH_ID(_foreach_cur) \ 1038 , BOOST_FOREACH_TYPEOF(COL)) 1039 1040#define BOOST_FOREACH_DEREF(COL) \ 1041 boost::foreach_detail_::deref( \ 1042 BOOST_FOREACH_ID(_foreach_cur) \ 1043 , BOOST_FOREACH_TYPEOF(COL)) 1044 1045#define BOOST_FOREACH_RBEGIN(COL) \ 1046 boost::foreach_detail_::rbegin( \ 1047 BOOST_FOREACH_ID(_foreach_col) \ 1048 , BOOST_FOREACH_TYPEOF(COL) \ 1049 , BOOST_FOREACH_SHOULD_COPY(COL)) 1050 1051#define BOOST_FOREACH_REND(COL) \ 1052 boost::foreach_detail_::rend( \ 1053 BOOST_FOREACH_ID(_foreach_col) \ 1054 , BOOST_FOREACH_TYPEOF(COL) \ 1055 , BOOST_FOREACH_SHOULD_COPY(COL)) 1056 1057#define BOOST_FOREACH_RDONE(COL) \ 1058 boost::foreach_detail_::rdone( \ 1059 BOOST_FOREACH_ID(_foreach_cur) \ 1060 , BOOST_FOREACH_ID(_foreach_end) \ 1061 , BOOST_FOREACH_TYPEOF(COL)) 1062 1063#define BOOST_FOREACH_RNEXT(COL) \ 1064 boost::foreach_detail_::rnext( \ 1065 BOOST_FOREACH_ID(_foreach_cur) \ 1066 , BOOST_FOREACH_TYPEOF(COL)) 1067 1068#define BOOST_FOREACH_RDEREF(COL) \ 1069 boost::foreach_detail_::rderef( \ 1070 BOOST_FOREACH_ID(_foreach_cur) \ 1071 , BOOST_FOREACH_TYPEOF(COL)) 1072 1073/////////////////////////////////////////////////////////////////////////////// 1074// BOOST_FOREACH 1075// 1076// For iterating over collections. Collections can be 1077// arrays, null-terminated strings, or STL containers. 1078// The loop variable can be a value or reference. For 1079// example: 1080// 1081// std::list<int> int_list(/*stuff*/); 1082// BOOST_FOREACH(int &i, int_list) 1083// { 1084// /* 1085// * loop body goes here. 1086// * i is a reference to the int in int_list. 1087// */ 1088// } 1089// 1090// Alternately, you can declare the loop variable first, 1091// so you can access it after the loop finishes. Obviously, 1092// if you do it this way, then the loop variable cannot be 1093// a reference. 1094// 1095// int i; 1096// BOOST_FOREACH(i, int_list) 1097// { ... } 1098// 1099#define BOOST_FOREACH(VAR, COL) \ 1100 BOOST_FOREACH_PREAMBLE() \ 1101 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else \ 1102 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \ 1103 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_END(COL)) {} else \ 1104 for (bool BOOST_FOREACH_ID(_foreach_continue) = true; \ 1105 BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_DONE(COL); \ 1106 BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_NEXT(COL) : (void)0) \ 1107 if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \ 1108 for (VAR = BOOST_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true) 1109 1110/////////////////////////////////////////////////////////////////////////////// 1111// BOOST_REVERSE_FOREACH 1112// 1113// For iterating over collections in reverse order. In 1114// all other respects, BOOST_REVERSE_FOREACH is like 1115// BOOST_FOREACH. 1116// 1117#define BOOST_REVERSE_FOREACH(VAR, COL) \ 1118 BOOST_FOREACH_PREAMBLE() \ 1119 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else \ 1120 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_RBEGIN(COL)) {} else \ 1121 if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_REND(COL)) {} else \ 1122 for (bool BOOST_FOREACH_ID(_foreach_continue) = true; \ 1123 BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_RDONE(COL); \ 1124 BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_RNEXT(COL) : (void)0) \ 1125 if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \ 1126 for (VAR = BOOST_FOREACH_RDEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true) 1127 1128#endif