boost bind expression not doing what I expect
-
I obviously don't get this bind stuff as I cannot seem to get it right
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <boost/bind.hpp>using namespace boost::bind;
typedef int DWORD;
typedef std::pair<std::string, bool> user_info;
typedef std::map<DWORD, user_info> USER_MAP;
typedef std::vector<DWORD> VEC_STAFF;int _tmain(int argc, _TCHAR* argv[])
{
USER_MAP m_Users;
VEC_STAFF Staff;VEC\_STAFF::iterator it = std::partition(Staff.begin(), Staff.end(),(bind(&USER\_MAP::find, m\_Users, \_1) != m\_Users.end()));
What I wanted to code to do is that for every entry in the Staff vector it should check to see whether that user id was present in the map, and if so move those items to the front. I have an example using a functor that works as I hoped the above code would, but the bind version is obviously not doing what I think its doing.
struct InUsersMap : public std::unary_function<USER_MAP::key_type,bool>
{
InUsersMap(USER_MAP & theMap, USER_MAP::const_iterator end)
: m_theMap(theMap)
{
}
inline bool operator()(CSecurePatients::USER_MAP::key_type& id) const
{
return m_theMap.find(id) != m_theMap.end();
}
private:
const USER_MAP &m_theMap;
}Finally does anyone know how to avoid getting the socket bind function from windows being included