map_tie.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_MAP_TIE_07222005_1247)
  7. #define FUSION_MAP_TIE_07222005_1247
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/container/map/map.hpp>
  10. #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
  11. # include <boost/fusion/container/generation/detail/pp_map_tie.hpp>
  12. #else
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // C++11 variadic interface
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #include <boost/fusion/support/pair.hpp>
  17. namespace boost { namespace fusion
  18. {
  19. namespace result_of
  20. {
  21. template <typename ...Key>
  22. struct map_tie
  23. {
  24. template <typename ...T>
  25. struct apply
  26. {
  27. typedef map<fusion::pair<Key, T&>...> type;
  28. };
  29. };
  30. }
  31. template <typename ...Key, typename ...T>
  32. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  33. inline map<fusion::pair<Key, T&>...>
  34. map_tie(T&... arg)
  35. {
  36. typedef map<fusion::pair<Key, T&>...> result_type;
  37. return result_type(arg...);
  38. }
  39. }}
  40. #endif
  41. #endif