I have following code to merge two std::maps.
template <typename key, typename value>
void merge_maps(std::map<key, value>& one, const std::map<key, value>& another,
boost::function2<value, value, value> aggregate)
{
// MERGING. aggregate is called if key exists in both maps
}
I have some struct like this.
struct foo {
int bar;
foo operator+(const foo& other) const;
};
I tries to merge two std::map<std::wstring, foo> one, another using foo::operator+ which I passed using boost::lambda, but get compilation error.
merge_maps(one, another, _1+_2); // MSCV9.0 cannot deduce template argument for lambda there
Help me please. What I’m doing wrong?
Solved. It was needed to specify lambda return type. MSVC instantiates template without any troubles.