Skip to content

Conversation

@awulkiew
Copy link
Member

@awulkiew awulkiew commented Nov 7, 2020

If you see our regression tests it looks like the majority of them compiles with VS2015:
https://www.boost.org/development/tests/develop/developer/geometry.html

Therefore I checked how much effort would it take to make all of them to compile. It seems that it was not much. VS2015 doesn't have full constexpr support and boost::variant's is implemented using dummy template parameters instead of parameter pack.

For constexpr it was sufficient to disable it in some places and add explicitly initialize class member in other.

In order to analyze types of boost::variant I decided to not use Boost.MPL as it was before but instead to check raw template parameters, i.e. to check if they are geometries or not. This works for both dummy parameters and types that are not geometries. And while currently non-geometries are not supported in other places of the library we could consider supporting them. An example would be something like:

boost::variant<point, polygon, std::string> v = polygon{{{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}}};
auto a = area(v);

Right now this code would not compile. At least I think it would not. But I don't see a semantic reason why it shouldn't. So in the future we could consider expanding the change done in this PR to the whole library.

What do you think about these workarounds?
Does it make sense to support vs2015?

@awulkiew awulkiew added this to the 1.75 milestone Nov 7, 2020
Copy link
Member

@vissarion vissarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have a strong opinion against supporting VS2015, so I am ok with this patch.

{};

// Workaround for VS2015
#if (_MSC_VER < 1910)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be explicitly _MSC_VER == 1900 or there is hope that the workaround will also work with older than VS15 versions ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think that the older VS will compile the library.

This way the checks are symmetric, i.e. < 1910 vs >= 1910.

@awulkiew
Copy link
Member Author

@mloskot @barendgehrels Do you have anything against merging it?

Copy link
Collaborator

@barendgehrels barendgehrels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me

@awulkiew awulkiew merged commit 632d1fc into boostorg:develop Nov 23, 2020
@awulkiew
Copy link
Member Author

The #ifdefs were disabling constexpr with other compilers incorrectly.
I fixed it here: 928603f

@barendgehrels
Copy link
Collaborator

Yes, better, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants