/Src/Dependencies/Boost/boost/fusion/sequence/intrinsic/empty.hpp

http://hadesmem.googlecode.com/ · C++ Header · 60 lines · 45 code · 8 blank · 7 comment · 1 complexity · 242f2ae2995f14b094f41c882950e9e3 MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2006 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !defined(FUSION_EMPTY_09162005_0335)
  7. #define FUSION_EMPTY_09162005_0335
  8. #include <boost/fusion/sequence/intrinsic/size.hpp>
  9. #include <boost/mpl/bool.hpp>
  10. #include <boost/fusion/support/tag_of.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. // Special tags:
  14. struct sequence_facade_tag;
  15. struct mpl_sequence_tag; // mpl sequence tag
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct empty_impl
  20. {
  21. template <typename Sequence>
  22. struct apply
  23. : mpl::bool_<(result_of::size<Sequence>::value == 0)>
  24. {};
  25. };
  26. template <>
  27. struct empty_impl<sequence_facade_tag>
  28. {
  29. template <typename Sequence>
  30. struct apply : Sequence::template empty<Sequence> {};
  31. };
  32. template <>
  33. struct empty_impl<mpl_sequence_tag>;
  34. }
  35. namespace result_of
  36. {
  37. template <typename Sequence>
  38. struct empty
  39. : extension::empty_impl<typename detail::tag_of<Sequence>::type>::
  40. template apply<Sequence>
  41. {};
  42. }
  43. template <typename Sequence>
  44. inline typename result_of::empty<Sequence>::type
  45. empty(Sequence const&)
  46. {
  47. typedef typename result_of::empty<Sequence>::type result;
  48. return result();
  49. }
  50. }}
  51. #endif