convert.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 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_CONVERT_09232005_1341)
  7. #define FUSION_CONVERT_09232005_1341
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/container/set/detail/as_set.hpp>
  10. #include <boost/fusion/container/set/detail/convert_impl.hpp>
  11. #include <boost/fusion/container/set/set.hpp>
  12. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  13. #include <boost/fusion/sequence/intrinsic/size.hpp>
  14. namespace boost { namespace fusion
  15. {
  16. namespace result_of
  17. {
  18. template <typename Sequence>
  19. struct as_set
  20. {
  21. typedef typename detail::as_set<result_of::size<Sequence>::value> gen;
  22. typedef typename gen::
  23. template apply<typename result_of::begin<Sequence>::type>::type
  24. type;
  25. };
  26. }
  27. template <typename Sequence>
  28. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. inline typename result_of::as_set<Sequence>::type
  30. as_set(Sequence& seq)
  31. {
  32. typedef typename result_of::as_set<Sequence>::gen gen;
  33. return gen::call(fusion::begin(seq));
  34. }
  35. template <typename Sequence>
  36. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  37. inline typename result_of::as_set<Sequence const>::type
  38. as_set(Sequence const& seq)
  39. {
  40. typedef typename result_of::as_set<Sequence const>::gen gen;
  41. return gen::call(fusion::begin(seq));
  42. }
  43. }}
  44. #endif