value_at_impl.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Copyright (c) 2018 Kohei Takahashi
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #if !defined(BOOST_FUSION_VALUE_AT_IMPL_20061101_0745)
  9. #define BOOST_FUSION_VALUE_AT_IMPL_20061101_0745
  10. #include <boost/fusion/support/config.hpp>
  11. #include <boost/fusion/sequence/intrinsic/value_at.hpp>
  12. #include <boost/utility/result_of.hpp>
  13. namespace boost { namespace fusion {
  14. struct transform_view_tag;
  15. struct transform_view2_tag;
  16. namespace extension
  17. {
  18. template<typename Tag>
  19. struct value_at_impl;
  20. template<>
  21. struct value_at_impl<transform_view_tag>
  22. {
  23. template<typename Seq, typename N>
  24. struct apply
  25. {
  26. typedef typename Seq::transform_type F;
  27. typedef typename result_of::value_at<typename Seq::sequence_type, N>::type value_type;
  28. typedef typename boost::result_of<F(value_type)>::type type;
  29. };
  30. };
  31. template<>
  32. struct value_at_impl<transform_view2_tag>
  33. {
  34. template<typename Seq, typename N>
  35. struct apply
  36. {
  37. typedef typename Seq::transform_type F;
  38. typedef typename result_of::value_at<typename Seq::sequence1_type, N>::type value1_type;
  39. typedef typename result_of::value_at<typename Seq::sequence2_type, N>::type value2_type;
  40. typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
  41. };
  42. };
  43. }
  44. }}
  45. #endif