mapbox / variant

C++11/C++14 Variant
BSD 3-Clause "New" or "Revised" License
371 stars 101 forks source link

use C++17 disjunction for no-references and one-convertible tests #116

Closed lightmare closed 8 years ago

lightmare commented 8 years ago

Refs #100 and partially replaces #114. Instead of counting the number of convertible alternatives before picking a convertible type, it does the check inside covertible_type -- after finding the first one that is_convertible, all remaining types must be non-convertible. That can easily be checked with std::disjunction.

Then I found another use for std::disjunction in the static_assert that forbids references, and replaced that as well, removing static_none_of (and also static_all_of which was unused).

artemp commented 8 years ago

👍 good stuff, looking forward to digging it properly tomorrow. What compiler are you using?

lightmare commented 8 years ago

Tested it with g++-6 (which has std::disjunction in libstdc++), clang-3.8 and clang-3.6; with -std=c++{11,14,1z}