BVB Source Codes

mars Show iterator.hpp Source code

Return Download mars: download iterator.hpp Source code - Download mars Source code - Type:.hpp
  1.  
  2. #ifndef BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
  3. #define BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
  4.  
  5. // Copyright Aleksey Gurtovoy 2000-2004
  6. //
  7. // Distributed under the Boost Software License, Version 1.0.
  8. // (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // See http://www.boost.org/libs/mpl for documentation.
  12.  
  13. // $Id$
  14. // $Date$
  15. // $Revision$
  16.  
  17. #include <boost/mpl/vector/aux_/at.hpp>
  18. #include <boost/mpl/iterator_tags.hpp>
  19. #include <boost/mpl/plus.hpp>
  20. #include <boost/mpl/minus.hpp>
  21. #include <boost/mpl/advance_fwd.hpp>
  22. #include <boost/mpl/distance_fwd.hpp>
  23. #include <boost/mpl/next.hpp>
  24. #include <boost/mpl/prior.hpp>
  25. #include <boost/mpl/aux_/nttp_decl.hpp>
  26. #include <boost/mpl/aux_/value_wknd.hpp>
  27. #include <boost/mpl/aux_/config/ctps.hpp>
  28. #include <boost/mpl/aux_/config/workaround.hpp>
  29.  
  30. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost { namespace mpl {
  31.  
  32. template<
  33.       typename Vector
  34.     , BOOST_MPL_AUX_NTTP_DECL(long, n_)
  35.     >
  36. struct v_iter
  37. {
  38.     typedef aux::v_iter_tag tag;
  39.     typedef random_access_iterator_tag category;
  40.     typedef typename v_at<Vector,n_>::type type;
  41.  
  42.     typedef Vector vector_;
  43.     typedef mpl::long_<n_> pos;
  44.  
  45. #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  46.     enum {
  47.           next_ = n_ + 1
  48.         , prior_ = n_ - 1
  49.         , pos_ = n_
  50.     };
  51.    
  52.     typedef v_iter<Vector,next_> next;
  53.     typedef v_iter<Vector,prior_> prior;
  54. #endif
  55.  
  56. };
  57.  
  58.  
  59. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  60.  
  61. template<
  62.       typename Vector
  63.     , BOOST_MPL_AUX_NTTP_DECL(long, n_)
  64.     >
  65. struct next< v_iter<Vector,n_> >
  66. {
  67.     typedef v_iter<Vector,(n_ + 1)> type;
  68. };
  69.  
  70. template<
  71.       typename Vector
  72.     , BOOST_MPL_AUX_NTTP_DECL(long, n_)
  73.     >
  74. struct prior< v_iter<Vector,n_> >
  75. {
  76.     typedef v_iter<Vector,(n_ - 1)> type;
  77. };
  78.  
  79. template<
  80.       typename Vector
  81.     , BOOST_MPL_AUX_NTTP_DECL(long, n_)
  82.     , typename Distance
  83.     >
  84. struct advance< v_iter<Vector,n_>,Distance>
  85. {
  86.     typedef v_iter<
  87.           Vector
  88.         , (n_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(long, Distance))
  89.         > type;
  90. };
  91.  
  92. template<
  93.       typename Vector
  94.     , BOOST_MPL_AUX_NTTP_DECL(long, n_)
  95.     , BOOST_MPL_AUX_NTTP_DECL(long, m_)
  96.     >
  97. struct distance< v_iter<Vector,n_>, v_iter<Vector,m_> >
  98.     : mpl::long_<(m_ - n_)>
  99. {
  100. };
  101.  
  102. #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  103.  
  104. template<> struct advance_impl<aux::v_iter_tag>
  105. {
  106.     template< typename Iterator, typename N > struct apply
  107.     {
  108.         enum { pos_ = Iterator::pos_, n_ = N::value };
  109.         typedef v_iter<
  110.               typename Iterator::vector_
  111.             , (pos_ + n_)
  112.             > type;
  113.     };
  114. };
  115.  
  116. template<> struct distance_impl<aux::v_iter_tag>
  117. {
  118.     template< typename Iter1, typename Iter2 > struct apply
  119.     {
  120.         enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ };
  121.         typedef long_<( pos2_ - pos1_ )> type;
  122.         BOOST_STATIC_CONSTANT(long, value = ( pos2_ - pos1_ ));
  123.     };
  124. };
  125.  
  126. #endif
  127.  
  128. }}
  129.  
  130. #endif // BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
  131.  
downloaditerator.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top