Hi Peeps
I have this cut down code example
#include <vector>
#include <map>
#include <algorithm>
#include
#include
#include
template < typename Iter, typename Pred >
bool any_of_if( Iter first, Iter last, Pred pred )
{ return std :: find_if( first, last, pred ) != last; }
struct A { };
bool fnOfA( const A & );
typedef std :: vector< boost :: shared_ptr< A > > VecOfPtr;
typedef std :: map< int, VecOfPtr > MapOfVecOfPtr;
bool contains_if(
const VecOfPtr &,
bool ( * pred )( const VecOfPtr :: value_type :: value_type &)
);
bool f( const boost :: shared_ptr< MapOfVecOfPtr > & myMap )
{
using namespace boost;
return any_of_if(
myMap -> begin( ),
myMap -> end( ),
lambda :: bind(
contains_if,
lambda :: bind( & MapOfVecOfPtr :: value_type :: second, lambda ::
_1 ),
fnOfA
)
);
}
This compiles under gcc (3.4.4), but under Vis Studio 2008 gives a huge
error message,
(attached), but summarised as
boost\boost/tuple/detail/tuple_basic.hpp(439) : error C2664:
'boost::tuples::detail::non_storeable_type<T>::non_storeable_type(const
boost::tuples::detail::non_storeable_type<T> &)' : cannot convert parameter
1 from 'bool (__cdecl &)(const A &)' to 'const
boost::tuples::detail::non_storeable_type<T> &'
It also goes away if I introduce a temporary local variable for fnOfA.
Is this a know bug in VisStudio or Boost, possibly with a known solution?
Thanks,
- Rob.