List comprehension in C++ #5066
-
Using list comprehension in python is easy for a piece of code resembling the one below How can something like this be implemented in C++? |
Beta Was this translation helpful? Give feedback.
Answered by
NikolajBjorner
Apr 24, 2021
Replies: 1 comment 1 reply
-
Most typically you use a for-loop and push_back on the expr_vector object. With lambdas you can approach code that looks like comprehensions, but of course, C++ does not support comprehensions. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
NikolajBjorner
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most typically you use a for-loop and push_back on the expr_vector object. With lambdas you can approach code that looks like comprehensions, but of course, C++ does not support comprehensions.