pair_tie.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 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 (BOOST_FUSION_PAIR_TIE_20060812_2058)
  8. #define BOOST_FUSION_PAIR_TIE_20060812_2058
  9. #include <boost/type_traits/is_const.hpp>
  10. #include <boost/utility/enable_if.hpp>
  11. namespace boost { namespace fusion {
  12. template<typename Key, typename T>
  13. struct pair;
  14. namespace result_of
  15. {
  16. template<typename Key, typename T>
  17. struct pair_tie
  18. {
  19. typedef fusion::pair<Key, T&> type;
  20. };
  21. }
  22. template<typename Key, typename T>
  23. typename disable_if<is_const<T>, typename result_of::pair_tie<Key, T>::type>::type
  24. pair_tie(T& t)
  25. {
  26. return typename result_of::pair_tie<Key, T>::type(t);
  27. }
  28. template<typename Key, typename T>
  29. typename result_of::pair_tie<Key, T const>::type
  30. pair_tie(T const& t)
  31. {
  32. return typename result_of::pair_tie<Key, T const>::type(t);
  33. }
  34. }}
  35. #endif