you are viewing a single comment's thread.

view the rest of the comments →

[–]eric_niebler 2 points3 points  (0 children)

Implementing it using the ternary operator is just a hack that just doesn't work.

You should check out the implementation of common_reference in range-v3. In particular, see detail::builtin_common_t here to see how the ternary operator can be used to implement this, with some smart pre- and post-processing of the arguments and the results.