let's say I have an very simple function called `foo`. Foo can return two values, I'll use `x` and `y` as arbitrary placeholder variables.

I define it like so:

```cpp
int foo(bool expression)
{
    static const int x = ..., y = ...;

    if(expression)
        return x;
    else
        return y;
}

```

This **obviously** a branching statement

I was thinking doing something like the following could remove any branching:

```cpp
int foo(bool expression)
{
    static const int array[] = {x, y};

    return array[expression];
}

```

Yet I'm not sure if, by using C arrays, it still incurs branching, does it? Do C++ `std::` arrays or vectors cause branching?

Is it worth it to attempt to read from the array, or is it a waste of memory and execution speed?

And lastly, if the `expression` contained a logical expression, such as `&&`, does this mean it will still branch?