put
fn
void put(R, E)(ref R r, E e)Outputs e to r. The exact effect is dependent upon the two types. Several cases are accepted, as described below. The code snippets are attempted in order, and the first to compile "wins" and gets evaluated.
In this table "doPut" is a method that places e into r, using the correct primitive: r.put(e) if R defines put, r.front = e if r is an input range (followed by r.popFront()), or r(e) otherwise.
| Code Snippet | Scenario |
|---|---|
r.doPut(e); |
R specifically accepts an E. |
r.doPut(e); |
R specifically accepts an E[]. |
r.putChar(e); |
R accepts some form of string or character. put will
transcode the character |
for (; !e.empty; e.popFront()) put(r, e.front); |
Copying range E into R. |
Tip: put should not be used "UFCS-style", e.g. r.put(e). Doing this may call R.put directly, by-passing any transformation feature provided by Range.put. put(r, e) is prefered.