New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
iota.hpp in vendors/XIOS/current/extern/boost/include/boost/range/algorithm_ext – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/range/algorithm_ext/iota.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 1.6 KB
Line 
1// Boost.Range library
2//
3//  Copyright Neil Groves 2009. Use, modification and
4//  distribution is subject to the Boost Software License, Version
5//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6//  http://www.boost.org/LICENSE_1_0.txt)
7//
8// For more information, see http://www.boost.org/libs/range/
9//
10#ifndef BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
11#define BOOST_RANGE_ALGORITHM_EXT_IOTA_HPP_INCLUDED
12
13#include <boost/range/config.hpp>
14#include <boost/range/concepts.hpp>
15#include <boost/range/iterator.hpp>
16#include <boost/range/begin.hpp>
17#include <boost/range/end.hpp>
18
19namespace boost
20{
21    namespace range
22    {
23
24template< class ForwardRange, class Value >
25inline ForwardRange& iota( ForwardRange& rng, Value x )
26{
27    BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
28    typedef BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type iterator_t;
29
30    iterator_t last_target = ::boost::end(rng);
31    for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
32        *target = x;
33
34    return rng;
35}
36
37template< class ForwardRange, class Value >
38inline const ForwardRange& iota( const ForwardRange& rng, Value x )
39{
40    BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
41    typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type iterator_t;
42   
43    iterator_t last_target = ::boost::end(rng);
44    for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
45        *target = x;
46   
47    return rng;
48}
49
50    } // namespace range
51    using range::iota;
52} // namespace boost
53
54#endif // include guard
Note: See TracBrowser for help on using the repository browser.