From f14309e92ddc5fd7f3263b25875cd62be2bb2711 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 8 Dec 2019 02:07:17 +0200 Subject: [PATCH] Fix ambiguity in mp_similar, Y<>> --- include/boost/mp11/function.hpp | 5 +++++ test/mp_similar.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index 8e1114a..1aeccac 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -188,6 +188,11 @@ template class L, class... T1, class... T2> struct mp_similar using type = mp_true; }; +template class L, class... T> struct mp_similar_impl, L> +{ + using type = mp_true; +}; + template struct mp_similar_impl { using type = mp_all< typename mp_similar_impl::type, typename mp_similar_impl::type, typename mp_similar_impl::type... >; diff --git a/test/mp_similar.cpp b/test/mp_similar.cpp index 5fb538f..140c4ed 100644 --- a/test/mp_similar.cpp +++ b/test/mp_similar.cpp @@ -33,12 +33,17 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); BOOST_TEST_TRAIT_TRUE((std::is_same>, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, X>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same, X>, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, X, X>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same, X, X>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same>, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, Y<>>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same, Y>, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, Y<>, Y<>>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same, Y, Y>, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, Y<>, Y<>, Y<>>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same, Y, Y, Y>, mp_true>)); return boost::report_errors();