I'm trying to copy a map (i want to copy _citymap to _the_cities) using copy_if. this is my code:
std::map <string, pair <float,float>> _citymap;
copy_if(_citymap.begin(),_citymap.end(),
std::inserter(_the_cities,_the_cities.end()),
[this](decltype(_citymap)::value_type const &kv_pair) {
return (Manhattan_Distance(kv_pair.second));});
the function Manhattan_Distance is a bool function:
bool Search:: Manhattan_Distance (const pair <float, float> &the_pair)
{
return (_radius >= fabs(_citymap[_city].first-the_pair.first) +
fabs(_citymap[_city].second-the_pair.second));
}
The errors I get:
error C3499: a lambda that has been specified to have a void return type cannot return a value
IntelliSense: class "std::map (std::string, std::pair(float, float), std::less(std::string), std::allocator(std::pair(const std::string, std::pair(float, float>>>>" has no member "second"
error C2039: 'second' : is not a member of 'std::map<_Kty,_Ty>'
thank you for your help!