Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions include/boost/foreach.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@
# include <boost/type_traits/remove_const.hpp>
#endif

// workaround for name clash with qt's foreach
#if defined(BOOST_MSVC) || defined(BOOST_CLANG) || defined(BOOST_GCC)
# ifdef foreach
# define BOOST_QFOREACH_WORKAROUND
# pragma push_macro("foreach")
# endif
#endif


namespace boost
{

Expand Down Expand Up @@ -1124,4 +1133,11 @@ rderef(auto_any_t cur, type2type<T, C> *)
if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \
for (VAR = BOOST_FOREACH_RDEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true)

#if defined(BOOST_MSVC) || defined(BOOST_CLANG) || defined(BOOST_GCC)
# ifdef BOOST_QFOREACH_WORKAROUND
# undef BOOST_QFOREACH_WORKAROUND
# pragma pop_macro("foreach")
# endif
#endif

#endif
15 changes: 15 additions & 0 deletions include/boost/foreach_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
#ifndef BOOST_FOREACH_FWD_HPP
#define BOOST_FOREACH_FWD_HPP

// workaround for name clash with qt's foreach
#if defined(BOOST_MSVC) || defined(BOOST_CLANG) || defined(BOOST_GCC)
# ifdef foreach
# define BOOST_QFOREACH_WORKAROUND
# pragma push_macro("foreach")
# endif
#endif

// This must be at global scope, hence the uglified name
enum boost_foreach_argument_dependent_lookup_hack
{
Expand Down Expand Up @@ -48,4 +56,11 @@ namespace foreach

} // namespace boost

#if defined(BOOST_MSVC) || defined(BOOST_CLANG) || defined(BOOST_GCC)
# ifdef BOOST_QFOREACH_WORKAROUND
# undef BOOST_QFOREACH_WORKAROUND
# pragma pop_macro("foreach")
# endif
#endif

#endif