Looking at C++ compiler support, it appears that the untimed version of std::shared_mutex
is available in GCC 5.0+. However, even with gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)
, and compiling with -std=c++1z
, a simple initialization of a shared mutex ends up with:
error: ‘shared_mutex’ in namespace ‘std’ does not name a type
std::shared_mutex mutex_;
And no, I have already included the proper header: #include <shared_mutex>
.
It can't locate the proper header, because it does not seem to exist. Actually, the linker uses the library locate at /usr/include/c++/5/shared_mutex
, which contains only the implementation of the std::shared_timed_mutex
(like the C++14 standard).
I have installed gcc-5 and g++-5 by adding the repository at ppa:ubuntu-toolchain-r/test
and using update-alternatives
to properly set up their bins.
Is there something I can do to compile my code correctly using the newest C++17 standard? And probably is a stupid question to ask, but is it too early to start using -std=c++1z
even if it should be already supported? Because it is supported, right?