contains_impl.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED
  3. // Copyright Eric Friedman 2002
  4. // Copyright Aleksey Gurtovoy 2004
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // See http://www.boost.org/libs/mpl for documentation.
  11. // $Id$
  12. // $Date$
  13. // $Revision$
  14. #include <boost/mpl/contains_fwd.hpp>
  15. #include <boost/mpl/begin_end.hpp>
  16. #include <boost/mpl/find.hpp>
  17. #include <boost/mpl/not.hpp>
  18. #include <boost/mpl/aux_/traits_lambda_spec.hpp>
  19. #include <boost/mpl/aux_/config/forwarding.hpp>
  20. #include <boost/mpl/aux_/config/static_constant.hpp>
  21. #include <boost/type_traits/is_same.hpp>
  22. namespace boost { namespace mpl {
  23. template< typename Tag >
  24. struct contains_impl
  25. {
  26. template< typename Sequence, typename T > struct apply
  27. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  28. : not_< is_same<
  29. typename find<Sequence,T>::type
  30. , typename end<Sequence>::type
  31. > >
  32. {
  33. #else
  34. {
  35. typedef not_< is_same<
  36. typename find<Sequence,T>::type
  37. , typename end<Sequence>::type
  38. > > type;
  39. BOOST_STATIC_CONSTANT(bool, value =
  40. (not_< is_same<
  41. typename find<Sequence,T>::type
  42. , typename end<Sequence>::type
  43. > >::value)
  44. );
  45. #endif
  46. };
  47. };
  48. BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,contains_impl)
  49. }}
  50. #endif // BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED