map_tie.hpp 1.3 KB

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