|
Boost Users : |
From: gdprosch_at_[hidden]
Date: 2006-01-30 18:35:40
Let me apologize in advance for my ignorance but I have not been able to
update the following code successfully in order to migrate from Boost
1_29 to 1_33. Despite reading the boost::bind documentation a few times
I am failing to make the necessary connection regarding the use of _1,
_2 and handling the use of DeRef in the equal function below.
// Unary dereference functor (a functor that returns the value of the
specified
// parameter, dereferenced via operator*)
// (Note: This DeRef code is included in a separate header.)
template < class Ptr, class T >
struct DeRef
: public std::unary_function< Ptr, T >
{
T & operator()( Ptr & ptr ) const
{ return *ptr;}
};
// ---
// Compare LocalStringMap (a custom map container with Tag/Value pair).
// A TagValue is a class that contains a tag and a value (both strings)
// A TagValuePtr is a custom, dereferencable smart pointer.
inline bool LocalStringMap::operator==( const LocalStringMap &that )
const
{
// Must be same size
if( this->size() != that.size() ) { return false;}
return
equal( this->_list.begin(),
this->_list.end(),
that._list.begin(),
boost::compose_f_gx_hy( equal_to< TagValue >(),
DeRef< const TagValuePtr, const TagValue
>(),
DeRef< const TagValuePtr, const TagValue >()
) );
}
Any assistance with this would be most helpful. I get the impression
that I do not need to use the DeRef class the original author created
given boost:bind's more capable traits identification. Here's what I
have so far...
return
std::equal( this->_list.begin(),
this->_list.end(),
that._list.begin(),
boost::bind<bool>( std::equal_to< TagValue >(),
???
Thank you,
Greg Prosch
Micron Technology, Inc.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net