2

Here it says that the inability to partially specialize function templates directly is essentially an oversight or a defect.

If that's really the case - why wasn't this fixed in C++14? And more importantly - when will it be fixed? Is it expected for C++17 to allow for partial function template specialization?

Community
  • 1
  • 1
einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • 3
    Also, what's wrong with overloading? – Axalo Feb 03 '15 at 22:53
  • 2
    @Axalo: `templatevoid foo();` what would you like me to overload? – einpoklum Feb 03 '15 at 23:16
  • @Columbo: If [cppreference](www.cppreference.com) can indicate what's expected in C++17, I was guessing there's a working draft already. But - rephrased my question slightly. – einpoklum Feb 03 '15 at 23:18
  • I disagree with premise: overloading resolution would make specialization order exceedingly confusing. Currently overload resolution picks which (valid) one, then any specialization determines implementation. (SFINAE can be used to remove overloads from consideration). – Yakk - Adam Nevraumont Feb 03 '15 at 23:22
  • @einpoklum void foo() { foo(); } – Axalo Feb 03 '15 at 23:30
  • Related: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#229 – dyp Feb 03 '15 at 23:59
  • @Axalo: What is it you wanted me to notice about the piece of code you posted? – einpoklum Feb 04 '15 at 16:02
  • @einpoklum That you can overload `foo`. – Axalo Feb 05 '15 at 01:05
  • @Axalo: Ok, but I'm still not following what you want to convey to me. Sorry for being a bit dense, please be more verbose... – einpoklum Feb 05 '15 at 16:45
  • @Alaxo: (what's wrong with overloading). The standard allows specialisation of templates in namespace std, but to this day it does not allow overloading std functions. So the world has to continue to use `using std::swap; swap(a, b);` instead of just saying `std::swap(a, b)`. Partial function specialisation would fix that (as would allowing overloads). – Marc Mutz - mmutz May 02 '17 at 17:46

0 Answers0