How to insert an item every x position using std C++? : <p>I have the following vector:</p>

<pre><code> std::vector&lt;int&gt; v = {1,1,1,1,1,1,1,1,1,1,1,1};
</code></pre>

<p>I would like to insert 9 every 3 positions </p>

<pre><code> w = {1,1,1,9,1,1,1,9,1,1,1,9,1,1,1,9};
</code></pre>

<p>Could you provide a oneliner using std algorithm in c++ ? </p>
