diff --git a/include/boost/mp11/set.hpp b/include/boost/mp11/set.hpp index 808636b..d65e4ae 100644 --- a/include/boost/mp11/set.hpp +++ b/include/boost/mp11/set.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_MP11_SET_HPP_INCLUDED #define BOOST_MP11_SET_HPP_INCLUDED -// Copyright 2015, 2019 Peter Dimov. +// Copyright 2015, 2019, 2024 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -10,9 +10,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -94,6 +96,34 @@ template using mp_set_push_front = typename detail::mp_set_ namespace detail { +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + +struct mp_is_set_helper_start +{ + static constexpr bool value = true; + template static mp_false contains( T ); +}; + +template +struct mp_is_set_helper: Base +{ + static constexpr bool value = Base::value && !decltype( Base::contains( mp_identity{} ) )::value; + using Base::contains; + static mp_true contains( mp_identity ); +}; + +template struct mp_is_set_impl +{ + using type = mp_false; +}; + +template class L, class... T> struct mp_is_set_impl> +{ + using type = mp_bool, detail::mp_is_set_helper_start, detail::mp_is_set_helper>::value>; +}; + +#else + template struct mp_is_set_impl { using type = mp_false; @@ -104,6 +134,8 @@ template class L, class... T> struct mp_is_set_impl> using type = mp_to_bool, mp_set_push_back, T...> > >; }; +#endif // !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + } // namespace detail template using mp_is_set = typename detail::mp_is_set_impl::type;