[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:29:24 +0200 |
> On 9 Apr 2018, at 18:16, Frank Heckenbach <address@hidden> 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.
- Re: C++17 skeleton with move semantics and std::variant, (continued)
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/08
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/08
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: *** GMX Spamverdacht *** Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant,
Hans Åberg <=
Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Hans Åberg, 2018/04/09
- Re: C++17 skeleton with move semantics and std::variant, Frank Heckenbach, 2018/04/09