Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:31:09

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_COUNT_09162005_0158)
0008 #define FUSION_COUNT_09162005_0158
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/config.hpp>
0012 #include <boost/mpl/or.hpp>
0013 #include <boost/type_traits/is_convertible.hpp>
0014 #include <boost/fusion/support/detail/access.hpp>
0015 
0016 #if defined (BOOST_MSVC)
0017 #  pragma warning(push)
0018 #  pragma warning (disable: 4512) // assignment operator could not be generated.
0019 #endif
0020 
0021 namespace boost { namespace fusion { namespace detail
0022 { 
0023     template <bool is_convertible>
0024     struct compare_convertible;
0025 
0026     // T1 is convertible to T2 or vice versa
0027     template <>
0028     struct compare_convertible<true>
0029     {
0030         template <typename T1, typename T2>
0031         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0032         static bool
0033         call(T1 const& x, T2 const& y)
0034         {
0035             return x == y;
0036         }
0037     };
0038 
0039     // T1 is NOT convertible to T2 NOR vice versa
0040     template <>
0041     struct compare_convertible<false>
0042     {
0043         template <typename T1, typename T2>
0044         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0045         static bool
0046         call(T1 const&, T2 const&)
0047         {
0048             return false;
0049         }
0050     };
0051 
0052     template <typename T1>
0053     struct count_compare
0054     {
0055         typedef typename detail::call_param<T1>::type param;
0056         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0057         count_compare(param in_x)
0058             : x(in_x) {}
0059 
0060         template <typename T2>
0061         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0062         bool
0063         operator()(T2 const& y) const
0064         {
0065             return
0066                 compare_convertible<
0067                     mpl::or_<
0068                         is_convertible<T1, T2>
0069                       , is_convertible<T2, T1> 
0070                     >::value
0071                 >::call(x, y);
0072         }
0073 
0074         param x;
0075     };
0076 }}}
0077 
0078 #if defined (BOOST_MSVC)
0079 #  pragma warning(pop)
0080 #endif
0081 
0082 #endif
0083