Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Standard C++ Library Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

fill(), fill_n()

Module:  Standard C++ Library   Library:  Algorithms


Function

Local Index

No Entries

Summary

Algorithm that assigns the same value to the elements in a given range

Synopsis

#include <algorithm>

namespace std {
  template <class ForwardIterator, class T>
   void fill(ForwardIterator start, ForwardIterator finish,
             const T& value);

  template <class OutputIterator, class Size, class T>
  void fill_n(OutputIterator start, Size n, const T& value);
}

Description

The fill() and fill_n() algorithms are used to assign a value to the elements in a sequence. fill() assigns the value to all the elements designated by iterators in the range [start, finish).

The fill_n() algorithm assigns the value to all the elements designated by iterators in the range [start, start + n). fill_n() assumes that all iterators in the range [start, start + n) are dereferenceable, unless start is an insert iterator.

Type T must be Assignable, and Size must be convertible to an integral type.

Complexity

fill() makes exactly finish - start assignments, and fill_n() makes exactly n assignments.

Example

See Also

Algorithms

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 25.2.5



Previous fileTop of DocumentContentsIndex pageNext file

Copyright (c) 1994-2006 Rogue Wave Software, a Quovadx Division.
Licensed under the Apache License, Version 2.0.
Contact Rogue Wave about documentation or support issues. You can also seek help from other developers through the Apache stdcxx community (see below).

For more information on the Rogue Wave Standard C++ Library under open source, see Section 1.2 of the user's guide.