• + 11 comments

    This one took me a while to grasp. Kept trying to unpack the variadic parameter using recursive calls to reversed_binary_value(). But once I understood the problem better, I was able to solve it.

    Without giving too much away, here's what I did:

    template <bool ...digits>
    int reversed_binary_value()
    {
        const size_t size = sizeof...(digits);
        bool bits[size] = { digits... };
        
        // reverse order of array
        
        // convert bit array into integer number
        
        // return number
    }
    

    If anyone knows of a more appropriate way of solving this challenge, please let me know.