Till now I've been using gcc for compiling my C++ code in Ubuntu 16.04 server edition. But since the latest features of C++17 (mainly concurrency and parallelism) are not convered by the latest gcc, while in clang many of them are, I've been starting to use clang. What surprised me is that for one of previously gcc-debugged C++ files, while compiling with gcc : gcc version 7.3.0 (Ubuntu 7.3.0-21ubuntu1~16.04) the execution goes fine, if compiling clang : clang version 6.0.0 (tags/RELEASE_600/final), the compilation says error: no member named 'make_optional' in namespace 'std' :
`marco@PC:~/marcoTensor$ g++ -std=c++17 bigMatricesDiv01.cpp
-obigMatricesDiv01
marco@PC:~/marcoTensor$ ./bigMatricesDiv01
Timer MTensor::Tensor2D A = randU2<double>(20,400,2.7,4.6) : 154 ms
Timer MTensor::Tensor2D B = randN2<double>(20,400,3,2.6) :111 ms
Timer MTensor::Tensor2D ApB = A/B :0 ms
marco@PC:~/marcoTensor$ clang++ -std=c++17 -stdlib=libc++ -w -fcolor-
diagnostics bigMatricesDiv01.cpp -obigMatricesDiv01 -lc++experimental
In file included from bigMatricesDiv01.cpp:1:
In file included from ./tensorTypes.h:1:
In file included from ./MTensorUtils.h:1:
In file included from ./MTensor.h:5:
In file included from ./GeneralUtils.h:16:
./FunctionalApproach.h:953:27: error: no template named 'optional' in
namespace 'std'
auto transform(const std::optional<T1>& opt, F f) ->
decltype(std::make_optional(f(opt.value()))){
~~~~~^
./FunctionalApproach.h:953:68: error: no member named 'make_optional' in
namespace 'std'
auto transform(const std::optional<T1>& opt, F f) ->
decltype(std::make_optional(f(opt.value()))){
~~~~~^
./FunctionalApproach.h:955:17: error: no member named 'make_optional' in
namespace 'std'
return std::make_optional(f(opt.value()));
~~~~~^
3 errors generated.
` But: In FunctionalApproach.h:
#include <experimental/propagate_const>
#include <experimental/optional>
Any idea why clang says " no member named 'make_optional' in namespace 'std' "?