insert_range_impl.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id: insert_range_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
  11. // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
  12. // $Revision: 49267 $
  13. #include <boost/mpl/copy.hpp>
  14. #include <boost/mpl/clear.hpp>
  15. #include <boost/mpl/front_inserter.hpp>
  16. #include <boost/mpl/joint_view.hpp>
  17. #include <boost/mpl/iterator_range.hpp>
  18. #include <boost/mpl/aux_/na_spec.hpp>
  19. #include <boost/mpl/aux_/iter_push_front.hpp>
  20. #include <boost/mpl/aux_/traits_lambda_spec.hpp>
  21. #include <boost/mpl/aux_/config/forwarding.hpp>
  22. #include <boost/type_traits/same_traits.hpp>
  23. namespace boost { namespace mpl {
  24. // default implementation; conrete sequences might override it by
  25. // specializing either the 'insert_range_impl' or the primary
  26. // 'insert_range' template
  27. template< typename Tag >
  28. struct insert_range_impl
  29. {
  30. template<
  31. typename Sequence
  32. , typename Pos
  33. , typename Range
  34. >
  35. struct apply
  36. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  37. : reverse_copy<
  38. joint_view<
  39. iterator_range<typename begin<Sequence>::type,Pos>
  40. , joint_view<
  41. Range
  42. , iterator_range<Pos,typename end<Sequence>::type>
  43. >
  44. >
  45. , front_inserter< typename clear<Sequence>::type >
  46. >
  47. {
  48. #else
  49. {
  50. typedef typename reverse_copy<
  51. joint_view<
  52. iterator_range<typename begin<Sequence>::type,Pos>
  53. , joint_view<
  54. Range
  55. , iterator_range<Pos,typename end<Sequence>::type>
  56. >
  57. >
  58. , front_inserter< typename clear<Sequence>::type >
  59. >::type type;
  60. #endif
  61. };
  62. };
  63. BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_range_impl)
  64. }}
  65. #endif // BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED