convert_impl.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_CONVERT_IMPL_09232005_1340)
  8. #define FUSION_CONVERT_IMPL_09232005_1340
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/container/map/detail/cpp03/as_map.hpp>
  11. #include <boost/fusion/container/map/detail/cpp03/map.hpp>
  12. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  13. #include <boost/fusion/sequence/intrinsic/size.hpp>
  14. namespace boost { namespace fusion
  15. {
  16. struct map_tag;
  17. namespace extension
  18. {
  19. template <typename T>
  20. struct convert_impl;
  21. template <>
  22. struct convert_impl<map_tag>
  23. {
  24. template <typename Sequence>
  25. struct apply
  26. {
  27. typedef typename
  28. detail::as_map<
  29. result_of::size<Sequence>::value
  30. , is_base_of<
  31. associative_tag
  32. , typename traits::category_of<Sequence>::type>::value
  33. >
  34. gen;
  35. typedef typename gen::
  36. template apply<typename result_of::begin<Sequence>::type>::type
  37. type;
  38. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  39. static type call(Sequence& seq)
  40. {
  41. return gen::call(fusion::begin(seq));
  42. }
  43. };
  44. };
  45. }
  46. }}
  47. #endif