Код: Выделить всё
#include
#include
class Vector2d {
public:
double x, y;
Vector2d(double x, double y) : x(x), y(y) { }
};
int main() {
const double FoV = 50.0;
std::vector vecOfVector2d;
vecOfVector2d.emplace_back(Vector2d(2.0, 3.0));
vecOfVector2d.emplace_back(Vector2d(4.0, 5.0));
for (std::vector::const_iterator i = vecOfVector2d.begin(); i != vecOfVector2d.end(); ++i) {
const Vector2d vec = *i;
double xpos = rand() % 100; // Calculated but varies in each iteration
auto isBBoxInsideFOVHorizontal = [FoV, xpos, vec]()->bool{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78974300/local-functions-with-lambdas-put-them-inside-or-outside-for-loop[/url]