How to build Absolute function without using abs() or loop (if/else) , just work with operators (C++)

template<typename N>
N abs(const N& n)
{
    const N arr[2] = {n, -n};
    return arr[n < 0];
}

is one way. And it won't dump the pipeline either.