I was wondering if someone could help me with this issue. I have been reading that the are some problems with the use of the std::make_pair in VS2010 because it is overloaded, and I have found some workarounds that would work, however, I just can not find a way to make it work here for me.
Here is a part of the code so you can take a look:
namespace tree {
#define container std::vector
typedef container<IConnType const*> node_data;
///tree node's brief
struct tree_node
{
STD_STRING name;
node_data types;
};
struct branch;
typedef container<branch> sub_tree;
///branch's brief
struct branch
{
tree_node node;
sub_tree tree;
};
}
template<typename T>
///address of's brief
struct address_of
{
T* operator()(T& x) const
{
return &x;
}
T const* operator()(T const& x) const
{
return &x;
}
};
typedef std::pair<tree::branch*,HTREEITEM> step_info;
std::vector<step_info> steps;
/// after we fill steps ///
HTREEITEM new_item = m_conntree.InsertItem(&tvi); // m_conntree is a CTreeCtrl; tvi is a TVINSERTSTRUCT
std::transform(step.first->tree.begin()
, step.first->tree.end()
, std::back_inserter(steps)
, boost::bind(&std::make_pair<tree::branch*,HTREEITEM>
, boost::bind<tree::branch*>(address_of<tree::branch>()
, _1
)
, new_item
)
);
The problem is here (the rest of the code is just to give an idea):
std::transform(step.first->tree.begin()
, step.first->tree.end()
, std::back_inserter(steps)
, boost::bind(&std::make_pair<tree::branch*,HTREEITEM>
, boost::bind<tree::branch*>(address_of<tree::branch>()
, _1
)
, new_item
)
);
I tried to do a cast (as I had read in other thread) but it did not work... this is what I had tried:
typedef std::pair<tree::branch*,HTREEITEM> (*MakePairType)(tree::branch*,HTREEITEM);
std::transform(step.first->tree.begin()
, step.first->tree.end()
, std::back_inserter(steps)
, boost::bind((MakePairType)&std::make_pair<tree::branch*,HTREEITEM>
, boost::bind<tree::branch*>(address_of<tree::branch>()
, _1
)
, new_item
)
);
I hope anyone can help me with this one... I have been stuck for a long time trying to compile this project...
By the way, it throws me a lot of error in the boost::bind (more than a hundred)... and taking out the boost::bind, it gives me errors about not knowing which overload of std::make_pair to use,
Regards, and thanks in advance!