This is a followup for another question which is already resolved. But then, I receive this error:
error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
!std::is_same_v<typename std::iterator_traits<T>::value_type, void>, O
~~~~~^~~~~~~~~
is_same
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:831:61: note: 'is_same' declared here
template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
^
Based on previous answer:
... it was added in C++14, as were most of the other type trait
*_t
versions ... C++17 added*_v
versions as inline constexpr variables ...
So, is_same_v
is added by C++17. But I already add C++14 and C++17 to QMake by:
CONFIG += c++14
CONFIG += c++17
QMAKE_CXXFLAGS += -std=c++14
QMAKE_CXXFLAGS += -std=c++17
Is it possible that XCode (Clang) lacks some C++17 features? My Xcode version is 9.4.1 and my Clang++ version is:
$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -v
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Code
There are both C++14 *_t
type trait versions and C++17 *_v
versions in the code which is from a repository with many contributors:
template<class T, class O = T>
using IteratorOnly = std::enable_if_t<
!std::is_same_v<typename std::iterator_traits<T>::value_type, void>, O
>;
Observation
When I use CONFIG += c++14
in QMake project file, I receive only this error:
enable_if_t
is fine andis_same_v
is bad
error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
When I use CONFIG += c++17
in QMake project file, I receive both these error:
- both
enable_if_t
andis_same_v
are bad
error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
Why?