Балуюсь Intel C++.
Так можно.
#include <iostream>
#include <algorithm>
#include <vector>
int main()
{
double arr[]={1,2.5,3,4,5};
std::vector<double> v(arr,arr+5);
typedef decltype(v[0]) ElemType;
std::for_each(v.begin(),v.end(),[&](ElemType e){std::cout << e << " " ;});
std::cout << std::endl;
for (auto it = v.begin(),end=v.end(); it !=end; ++it)
{
std::cout << *it << " " ;
}
std::cout << std::endl;
return 0;
}
А так нельзя
std::for_each(v.begin(),v.end(),[&](auto e){std::cout << e << " " ;});
Так ПОКА нельзя, или вообще никогда можно не будет?