共用方式為


checked_generate_n

Same as generate_n, but enforces the use of a checked iterator as output iterator. checked_generate_n is defined in the stdext namespace.

注意

This algorithm is a Microsoft extension to the Standard C++ Library. Code implemented using this algorithm will not be portable.

template<class OutputIterator, class Size, class Generator>
   void checked_generate_n(
      OutputIterator_First, 
      Size _Count, 
      Generator_Gen
   );

Parameters

  • _First
    An output iterator addressing the position of first element in the range to which values are to be assigned.

  • _Count
    A signed or unsigned integer type specifying the number of elements to be assigned a value by the generator function.

  • _Gen
    A function object that is called with no arguments that is used to generate the values to be assigned to each of the elements in the range.

Remarks

See generate_n for a code sample.

For more information on checked iterators, see Checked Iterators.

Requirements

Header: <algorithm>

Namespace: stdext

See Also

Concepts

<algorithm> Members

Standard Template Library