make_map.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*=============================================================================
  2. Copyright (c) 2001-2013 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_MAKE_MAP_07222005_1247)
  7. #define FUSION_MAKE_MAP_07222005_1247
  8. #include <boost/fusion/container/map/map.hpp>
  9. #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
  10. # include <boost/fusion/container/generation/detail/pp_make_map.hpp>
  11. #else
  12. ///////////////////////////////////////////////////////////////////////////////
  13. // C++11 variadic interface
  14. ///////////////////////////////////////////////////////////////////////////////
  15. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  16. #include <boost/fusion/support/pair.hpp>
  17. namespace boost { namespace fusion
  18. {
  19. namespace result_of
  20. {
  21. template <typename ...Key>
  22. struct make_map
  23. {
  24. template <typename ...T>
  25. struct apply
  26. {
  27. typedef map<
  28. fusion::pair<
  29. Key
  30. , typename detail::as_fusion_element<T>::type
  31. >...>
  32. type;
  33. };
  34. };
  35. }
  36. template <typename ...Key, typename ...T>
  37. inline map<
  38. fusion::pair<
  39. Key
  40. , typename detail::as_fusion_element<T>::type
  41. >...>
  42. make_map(T const&... arg)
  43. {
  44. typedef map<
  45. fusion::pair<
  46. Key
  47. , typename detail::as_fusion_element<T>::type
  48. >...>
  49. result_type;
  50. return result_type(arg...);
  51. }
  52. }}
  53. #endif
  54. #endif