[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++17 skeleton with move semantics and std::variant

From: Hans Åberg
Subject: Re: C++17 skeleton with move semantics and std::variant
Date: Mon, 9 Apr 2018 18:10:33 +0200

> On 9 Apr 2018, at 16:55, Frank Heckenbach <address@hidden> wrote:
> Hans Åberg wrote:
>>>> But, anyway, GCC7 supports C++17.
>>> Yes, and I've also tested it with gcc-6 with mpark's variant.
>> 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>;

> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]