1
0
forked from boostorg/bind

Fixed a visit_each-related bug exposed by strict two-phase lookup

[SVN r33841]
This commit is contained in:
Peter Dimov
2006-04-27 16:21:01 +00:00
parent 472f9e6ebe
commit a87638486b
3 changed files with 35 additions and 6 deletions

View File

@@ -1159,20 +1159,41 @@ BOOST_BIND_OPERATOR( >=, greater_equal )
#endif
// visit_each, ADL
#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
template<class V, class T> void visit_each( V & v, value<T> const & t, int )
{
using boost::visit_each;
BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
}
template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
{
t.accept( v );
}
#endif
} // namespace _bi
// visit_each
// visit_each, no ADL
template<class V, class T> void visit_each(V & v, _bi::value<T> const & t, int)
#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ )
template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
{
BOOST_BIND_VISIT_EACH(v, t.get(), 0);
BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
}
template<class V, class R, class F, class L> void visit_each(V & v, _bi::bind_t<R, F, L> const & t, int)
template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
{
t.accept(v);
t.accept( v );
}
#endif
// bind
#ifndef BOOST_BIND

View File

@@ -206,6 +206,11 @@
template<class V> void accept(V & v) const
{
#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
using boost::visit_each;
#endif
BOOST_BIND_VISIT_EACH(v, f_, 0);
l_.accept(v);
}

View File

@@ -22,6 +22,7 @@
#endif
#include <iostream>
#include <typeinfo>
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
# pragma warning(pop)
@@ -37,12 +38,14 @@ struct visitor
{
}
template<typename T> void operator()( T const & /*t*/ )
template<typename T> void operator()( T const & t )
{
std::cout << "visitor::operator()( T ): " << typeid( t ).name() << std::endl;
}
void operator()( int const & t )
{
std::cout << "visitor::operator()( int ): " << t << std::endl;
hash = hash * 10 + t;
}
};