#include <set>

int main()
    auto coll = std::multiset{ 1, 2, 2, 3, 4, 4, 7 };

The code above can be compiled by vc++ 2019 and g++ 9.0, but cannot be compiled by clang++ 8.0 as clang++ -std=c++2a -stdlib=libc++ main.cpp

Why does libc++ not support class template argument deduction on multiset?


Because it took until recently for someone to implement it.

These features don't write themselves, and different projects prioritise different things.

You are of course free to join the project and contribute any features you feel are missing!

  • Can you clarify, this was a limitation of the multiset implementation, not of the compiler not respecting the standard? (my understanding, but could be clearer) – Jeffrey Aug 13 at 14:55
  • 1
    @Jeffrey Is there a substantive difference? This feature (in part) relies on deduction guides implemented in the standard library, and that simply hadn't been done until recently. – Lightness Races in Orbit Aug 13 at 14:59

This has been implemented for the upcoming clang 9 release.

Your Answer

By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.