martinmoene / variant-lite

variant lite - A C++17-like variant, a type-safe union for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
239 stars 25 forks source link

Fix MSVC 2017 support #7

Closed grishavanika closed 6 years ago

grishavanika commented 6 years ago

Hi,

There are few problems when using MSVC 2017 that supports std::variant. First one is incorrect detection of supported features. I copied your change from optional-lite: https://github.com/martinmoene/optional-lite/commit/1cded319c771a68f8fc06f4ec4ac64075fcac343

Second problem is missing variant_npos definition. Looks like MSVC 2017 supports inline variables, but I'm not using it since I have no way to check other compilers.

Hope, changes make sense. Thank you

martinmoene commented 6 years ago

Thanks @grishavanika ,

variant lite has been written against p0088r1 (v6) IIRC, so it's not up to date, see p0088 latest and std::variant on cppreference.

I'm working on nonstd-wide alignment plan that will address the issues of this PR. The implementation will be somewhat different:

However, for now this PR looks fine to merge.

grishavanika commented 6 years ago

@martinmoene , thank you for details and links