Question: How can I position a mask loading layer and its message in the vertical and horizontal center while the view is still rendering? I want my controller to handle it. Is there another solution than masking after rendering?

What I tried:

`oView.getEl().mask( "Loading..." );` this will be displayed before rendering is done. The message box is displayed at the top of the panel. `setloading`'s message is what I want. However:

* `setLoading()` is not locked to the panel/view. If you drag the window/panel, the loading mask with message stays in the drag start and does not move with its window/panel. The loading message works perfectly `setLoading( 'Waiting...' );`
* `mask()` locks to the panel/view (yea!). But it gets displayed at the panel's top not center.

Answer: 
AFAIK you construct target.insert(iter, \*iter++) is not legal c++, as it leads to 'undefined behavior'. \*iter++ is legal, and is evaluated left-to-right, but order in which agruments of a function call are evaluated is not specified. Writing such an expression is a programming error.

to be precise, your code 

```
target.insert(iter, *iter++)

```

given aliases

```
std::vector<int>::iterator cur = iter;
std::vector<int>::iterator next = iter + 1;

```

can be evaluated in these 2 ways

```
targets.insert(next, *cur);
++iter;

```

or

```
targets.insert(cur, *cur);
++iter;

```

the exact version is a subject to compiler, os, other code etc and is generally not specified.
Although this is a very old question, i want to share my view and welcome to discuss.

```
target.insert(iter, *iter++)

```

this code will have some effects

* `*iter++`: get the value `*iter` and will invoke `iter++` in the future
* insert `*iter` to vector.

But insert value to vector may have different effects depends on size is equal to capacity or not

if `size == capacity`, vector need malloc new memory and copy to new memory, so the iterator need update

if `size < capacity`, vector insert item directly.

so back and focus to the code `iter = target.insert(iter, *iter++);`

if insert cause new memory, so using `iter++` will access to invalid address and result in **Segmentation fault**.

if you write code like this: `iter = target.insert(iter, *iter);`, iter will always update,so it is correct

So if you are definitely sure size always less than capacity after insert, you can use this code but not suggestion