how to move elements of an initializer_list?
<p>Let's say you have a variable of type <code>std::vector&lt;std::string&gt;</code> and you initialize it with an initializer list:</p>

<pre><code>using V = std::vector&lt;std::string&gt;;
V v = { "Hello", "little", "world", "of", "move", "semantics" };
</code></pre>

<p>The compiler will create a temporary <code>std::string</code> for each string literal, create an initializer list over these and then call the ctor for <code>V</code> and create the vector. The ctor does not know that all those strings are temporaries, so it is <strong>copying</strong> each string.</p>

<p>I haven't found anything in the standard which allows the vector ctor to move the elements when they are temporaries.</p>

<p>Am I missing something or does using initializer lists lead to unnecessary copies? I am writing classes where this problem could lead to significantly inefficient code. Any technique to avoid unnecessary copies would be greatly appreciated.</p>