79812333

Date: 2025-11-07 12:35:03
Score: 4.5
Natty:
Report link

@Caleth I'm interested to understand more about your comment

There's also specialisations, but the general advice is to never define specialisations of function templates, because of the interaction with overload resolution.

In addition, you constrained the compiler instantiation of the two versions of the do_something function.

You did this using

template<typename Stringable, std::enable_if_t<std::is_same_v<decltype(std::declval<Stringable>().to_string()), std::string>, int> = 0>

Can you tell us more about why? I would guess this is related to your first comment never define specialisations of function templates ?

Reasons:
  • Blacklisted phrase (0.5): why?
  • RegEx Blacklisted phrase (2.5): Can you tell us
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • User mentioned (1): @Caleth
  • Self-answer (0.5):
  • Looks like a comment (1):
  • High reputation (-2):
Posted by: user2138149