I have a project that currently uses C++11/14, but it requires something like std::filesystem
, which is only available in C++17, and hence I don't have a chance to currently use it. I see, however, that it's available in my current compiler as std::experimental::filesystem
. Is it a good idea to use experimental features, assuming that I could in the future add something like:
#ifdef CXX17 //if this is C++17
std::filesystem::something ...;
#else
std::experimental::filesystem::something ...;
#endif
My concerns are:
1. Is it guaranteed that all compliant compilers have the same experimental features?
2. Are experimental features prone to big changes that make them unreliable?
Maybe there's more things to wonder about. Why should I or should I not use them? I'm puzzled with a new project and don't know what to decide.
- Is it guaranteed that all compliant compilers have the same experimental features?
No, experimental features are optional.
- Are experimental features prone to big changes that make them unreliable?
Yes, the C++ committee might even decide to abandon a feature or in the process of standardization a defect might come up that would force a feature to change.
Generally, it's not a good idea to depend on experimental features. Experimental features are exactly what the word says (i.e., to experiment with).