问题描述:

I'm assuming the "i" is increment and the "a" is assign, but I could not figure out or find the answer. Also, it looks very similar to the non-standard itoa which I think is confusing.

网友答案:

From http://www.sgi.com/tech/stl/iota.html:

The name iota is taken from the programming language APL.

In his Turing Award lecture, Ken Iverson (inventor of APL) said this:

For example, the integer function denoted by ι produces a vector of the first N integers when applied to the argument N, …

That funny character is the lower-case Greek letter iota. I typed ι, U+03B9, “GREEK SMALL LETTER IOTA”, but Unicode actually has a dedicated code point for APL's iota: is U+2373, “APL FUNCTIONAL SYMBOL IOTA”.

网友答案:

Its the greek letter that sometimes gets used in mathematics to denote sets of numbers or unit vectors. In the C++ case, you get a constructed vector set. Nothing to do with itoa.

网友答案:

std::iota will fill an iterator range with successively incremented values.

To answer your specific question, it actually doesn't stand for anything. Iota ("eye-oh-duh") is a greek letter with mathematical connotations.

It is standard in C++11, but not in earlier standards.

网友答案:

Oh, I was always under the impression that since std::iota(start,end,0) essentially stands for

for(size_t i = 0; i < end; i ++) { start[i] = i; }

then you essentially "assign i" to each array element, and iota is greek for i, so there.

(I wouldn't be surprised if that was the rationale for the APL choice, mentioned in @robmayoff's answer, although I have no idea whether that's the case.)

相关阅读:
Top