> On 9 Apr 2018, at 18:16, Frank Heckenbach <f.heckenb...@fh-soft.de> wrote: > > Hans Åberg wrote: > >>>> One can have a preprocessor macro '#if (__cplusplus == 201703L) ...', >>>> would it be of interest. >>> >>> What would it do? (BTW, I think it should be ">=".) >> >> Something like, but with suitable template arguments: >> >> #if !(__cplusplus >= 201703L) >> namespace std { >> // Workaround when C++17 <variant> not available. >> template<class T> >> using variant = some::variant<T>; >> } >> #endif > > (Or simply "namespace std { using mpark::variant; }", I think.)
This is better. I use the workaround with Apple clang, which when finally got C++17 put those new types in std::experimental! >>> I don't want the skeleton to depend on an external library (and as I >>> said, there might be at least two candidates), so I think it's >>> better to leave it to the user. (For me, I've put mpark's variant >>> header in /usr/local/include for g++-6 to use, while g++-7 will use >>> its own variant implementation, so the parser will work with both >>> compilers without change.) >> >> Indeed, leave as it is. The idea above would leave it open for other users >> to introduce their own dependencies. > > I think so. With the various "%code" blocks etc., there are enough > possibilities for users to do the above or similar. It should suffice in %code requires.