identity_view.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2022 Denis Mikhailov
  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(BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED)
  7. #define BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/view/transform_view.hpp>
  10. #include <boost/functional/identity.hpp>
  11. #include <boost/utility/result_of.hpp>
  12. namespace boost { namespace fusion {
  13. namespace detail {
  14. struct identity : boost::identity
  15. {
  16. };
  17. }
  18. }}
  19. namespace boost {
  20. template<typename T>
  21. struct result_of<fusion::detail::identity(T)>
  22. {
  23. typedef T type;
  24. };
  25. }
  26. #ifdef _MSC_VER
  27. # pragma warning(push)
  28. # pragma warning(disable: 4512) // assignment operator could not be generated.
  29. #endif
  30. namespace boost { namespace fusion {
  31. template<typename Sequence> struct identity_view
  32. : transform_view<Sequence, detail::identity>
  33. {
  34. typedef transform_view<Sequence, detail::identity> base_type;
  35. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  36. identity_view(Sequence& in_seq)
  37. : base_type(in_seq, detail::identity()) {}
  38. };
  39. }}
  40. #ifdef _MSC_VER
  41. # pragma warning(pop)
  42. #endif
  43. #endif