1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>fill_n</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0"> 8<link rel="up" href="../mutating.html" title="Mutating algorithms"> 9<link rel="prev" href="fill.html" title="fill"> 10<link rel="next" href="generate.html" title="generate"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="fill.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mutating.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="generate.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="range.reference.algorithms.mutating.fill_n"></a><a class="link" href="fill_n.html" title="fill_n">fill_n</a> 28</h5></div></div></div> 29<h6> 30<a name="range.reference.algorithms.mutating.fill_n.h0"></a> 31 <span class="phrase"><a name="range.reference.algorithms.mutating.fill_n.prototype"></a></span><a class="link" href="fill_n.html#range.reference.algorithms.mutating.fill_n.prototype">Prototype</a> 32 </h6> 33<p> 34</p> 35<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">ForwardRange</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Size</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Value</span><span class="special">></span> 36<span class="identifier">ForwardRange</span><span class="special">&</span> <span class="identifier">fill</span><span class="special">(</span> <span class="identifier">ForwardRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">Size</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Value</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">);</span> 37</pre> 38<p> 39 </p> 40<h6> 41<a name="range.reference.algorithms.mutating.fill_n.h1"></a> 42 <span class="phrase"><a name="range.reference.algorithms.mutating.fill_n.description"></a></span><a class="link" href="fill_n.html#range.reference.algorithms.mutating.fill_n.description">Description</a> 43 </h6> 44<p> 45 <code class="computeroutput"><span class="identifier">fill_n</span></code> assigns the value 46 <code class="computeroutput"><span class="identifier">val</span></code> to <code class="computeroutput"><span class="identifier">n</span></code> elements in the range <code class="computeroutput"><span class="identifier">rng</span></code> beginning with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span></code>. 47 </p> 48<h6> 49<a name="range.reference.algorithms.mutating.fill_n.h2"></a> 50 <span class="phrase"><a name="range.reference.algorithms.mutating.fill_n.definition"></a></span><a class="link" href="fill_n.html#range.reference.algorithms.mutating.fill_n.definition">Definition</a> 51 </h6> 52<p> 53 Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">fill_n</span><span class="special">.</span><span class="identifier">hpp</span></code> 54 </p> 55<h6> 56<a name="range.reference.algorithms.mutating.fill_n.h3"></a> 57 <span class="phrase"><a name="range.reference.algorithms.mutating.fill_n.requirements"></a></span><a class="link" href="fill_n.html#range.reference.algorithms.mutating.fill_n.requirements">Requirements</a> 58 </h6> 59<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 60<li class="listitem"> 61 <code class="computeroutput"><span class="identifier">ForwardRange</span></code> is a 62 model of the <a class="link" href="../../../concepts/forward_range.html" title="Forward Range">Forward 63 Range</a> Concept. 64 </li> 65<li class="listitem"> 66 <code class="computeroutput"><span class="identifier">ForwardRange</span></code> is mutable. 67 </li> 68<li class="listitem"> 69 <code class="computeroutput"><span class="identifier">Value</span></code> is a model 70 of the <code class="computeroutput"><span class="identifier">AssignableConcept</span></code>. 71 </li> 72<li class="listitem"> 73 <code class="computeroutput"><span class="identifier">Value</span></code> is convertible 74 to <code class="computeroutput"><span class="identifier">ForwardRange</span></code>'s 75 value type. 76 </li> 77</ul></div> 78<h6> 79<a name="range.reference.algorithms.mutating.fill_n.h4"></a> 80 <span class="phrase"><a name="range.reference.algorithms.mutating.fill_n.complexity"></a></span><a class="link" href="fill_n.html#range.reference.algorithms.mutating.fill_n.complexity">Complexity</a> 81 </h6> 82<p> 83 Linear. Exactly <code class="computeroutput"><span class="identifier">n</span></code> assignments 84 are performed. 85 </p> 86</div> 87<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 88<td align="left"></td> 89<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen, 90 Neil Groves<p> 91 Distributed under the Boost Software License, Version 1.0. (See accompanying 92 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 93 </p> 94</div></td> 95</tr></table> 96<hr> 97<div class="spirit-nav"> 98<a accesskey="p" href="fill.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mutating.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="generate.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 99</div> 100</body> 101</html> 102