Question: I am trying to get the selected row ID when I click on the icon and/or link from a custom formatter but I am not able to get it, As soon as I click on the icon nothing happen (you can see it on the Fiddle). This is how the code I am working on looks like:

```
  $.fn.fmatter.customActionsFormatter = function(cellValue, options, rowData) {
    return '<a href="#" class="delete_row" title="Delete selected row"><span class="fa fa-fw fa-trash-o delete_row" data-id="' + rowData.Id + '"></span></a>';
  };

  $(".delete_row").click(function() {
    var rowid = $("#list").jqGrid('getGridParam', 'selrow');

    alert(rowid);
  });

```

Why is this not working? 

I have created a [Fiddle](https://jsfiddle.net/reynierpm/rmo2370r/4/) showing the issue. Just select one and try to click the icon you'll see how nothing happen

Answer: 
Conceptually, when writing to a range, you'd want to move to the next element after writing to one. For most iterators, like e.g. a `std::vector::iterator`, that has to be done explicitly. So it kind of makes sense to include it, if only for consistency.

In the particular case of `std::ostream_iterator`, it does not have an actual effect though, and could be left out. You cannot overwrite an "element" of the output range anyways, advancing is implicit (and only implicit, i.e. both the increment operators as well as derefencing are no-ops in this context).

The important part is only the [`operator =`](http://en.cppreference.com/w/cpp/iterator/ostream_iterator/operator%3D), as explained in the relevant documentation:

> 
> 
> ```
> #include <iostream>
> #include <iterator>
> 
> int main()
> {
>     std::ostream_iterator<int> i1(std::cout, ", ");
>     *i1++ = 1; // usual form, used by standard algorithms
>     *++i1 = 2;
>     i1 = 3; // neither * nor ++ are necessary
>     std::ostream_iterator<double> i2(std::cout);
>     i2 = 3.14;
> }
> 
> ```
> 
>
The `++` operator has no effect on `std::ostream_iterator`. Assigning to `*i2` automatically advances the output stream.

It's provided so that `ostream_iterator` can be used anywhere that an ordinary iterator is allowed, and most iterators have to be incremented explicitly.

Even with an ordinary iterator, it's generally only necessary to increment it if you use it multiple times. In the code snippet you found, where it's used just once, incrementing is totally unnecessary. It would be more reasonable if it were inside a loop.