I have a container class (containing a multi-index container) for which I have a public "foreach" member-function, so users can pass a functor to apply on all elements.
While implementing, I had a case where the functor should only be applied to some elements of a range in the container, so I overloaded the foreach, to pass some valid range.
Now, in some cases, it was worthwhile to stop on a certain condition, so practically, I let the foreach stop based on the return-value of the function.
I'm pleased with how the system works, but I have one concern:
How should a "foreach" on a range, with stop conditions be called?
Anyone knows a generic, clear and concise name?
It renders the corresponding component Sometimes, the container component can perform two functions (i.e. to render UI and hold logic). In a situation where a container component performs these. The component itself does not hold too many markups (JSX) and is void of CSS styles.
Let’s see what exactly is Applying a function to each element of a list means: Suppose we have a list of integers and a function that doubles each integer in this list. On applying the function to the list, the function should double all the integers in the list.
A container can contain anything, from a webservice, to a million LOC monolith, to a complete DBMS system, to the data tier that DBMS writes into. These containers can live forever, scale horizontally (or not), take 20 minutes to start, 20 days to run, and on and on. Contrast this to a Function, which typically has a set of known characteristics:
Container components can be primarily referred to as the parent elements of other components in a React app. They serve as a bridge between the normal components that render the UI and the logic that makes the UI components interactive and dynamic. The most common function of a container component is to obtain data.
Based on your description, i'd go for apply_until()
.
Maybe until
or something?
How about find_if(...)
, as in stl ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With