jeudi 2 juillet 2020

constexpr for loop compilation

I have read this and but i still do not know how to make this work with -std=gnu++2a I am not sure how to use integer seq. Could you please help me with adapting the below code so that it compiles? Thx

constexpr bool example(const int k)
{
    return k < 23 ? true: false;
}

constexpr bool looper()
{
    constexpr bool result = false;
    for(int k = 0; k < 20; k ++)
    {
        for (int i = 0 ; i < k; ++i)
        {
        constexpr bool result = example(i);
        }
    }

    return result;
}

int main()
{
    constexpr bool result = looper();
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire