source: XIOS/dev/dev_olga/src/extern/boost/include/boost/range/algorithm/generate.hpp @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 1.4 KB
Line 
1//  Copyright Neil Groves 2009. Use, modification and
2//  distribution is subject to the Boost Software License, Version
3//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
4//  http://www.boost.org/LICENSE_1_0.txt)
5//
6//
7// For more information, see http://www.boost.org/libs/range/
8//
9#ifndef BOOST_RANGE_ALGORITHM_GENERATE_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_GENERATE_HPP_INCLUDED
11
12#include <boost/concept_check.hpp>
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15#include <boost/range/concepts.hpp>
16#include <algorithm>
17
18namespace boost
19{
20    namespace range
21    {
22/// \brief template function generate
23///
24/// range-based version of the generate std algorithm
25///
26/// \pre ForwardRange is a model of the ForwardRangeConcept
27/// \pre Generator is a model of the UnaryFunctionConcept
28template< class ForwardRange, class Generator >
29inline ForwardRange& generate( ForwardRange& rng, Generator gen )
30{
31    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
32    std::generate(boost::begin(rng), boost::end(rng), gen);
33    return rng;
34}
35
36/// \overload
37template< class ForwardRange, class Generator >
38inline const ForwardRange& generate( const ForwardRange& rng, Generator gen )
39{
40    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
41    std::generate(boost::begin(rng), boost::end(rng), gen);
42    return rng;
43}
44
45    } // namespace range
46    using range::generate;
47} // namespace boost
48
49#endif // include guard
Note: See TracBrowser for help on using the repository browser.