Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
iota.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_IOTA_HPP
9#define ADOBE_ALGORITHM_IOTA_HPP
10
11#include <adobe/config.hpp>
12
13#include <adobe/functional.hpp>
14
15#include <boost/range/begin.hpp>
16#include <boost/range/end.hpp>
17
18#include <algorithm>
19
20/**************************************************************************************************/
21
22namespace adobe {
23
24/**************************************************************************************************/
46/**************************************************************************************************/
52template <class ForwardIterator, class T>
53T iota(ForwardIterator first, ForwardIterator last, const T& value) {
54 T result = value;
55 while (first != last) {
56 *first = result;
57 ++first;
58 ++result;
59 }
60 return result;
61}
62
68template <class ForwardRange, class T>
69T iota(ForwardRange& range, const T& value) {
70 return adobe::iota(boost::begin(range), boost::end(range), value);
71}
72
73/**************************************************************************************************/
74
75} // namespace adobe
76
77/**************************************************************************************************/
78
79#endif
80
81/**************************************************************************************************/
T iota(ForwardIterator first, ForwardIterator last, const T &value)
iota implementation
Definition iota.hpp:53