x3::symbols moves result and therefore removes it from the symbol_parser itself
<p>So, I ran into strange behaviour with boost::spirit::x3 as supplied in boost 1.59:</p>

<p>I defined a 'dynamic' symbol table via:
</p>

<pre><code>struct instructions : x3::symbols&lt;OpCode&gt; {
    instructions()
    {
        name("instructions");
    }

    void set_instruction_set(const std::unordered_map&lt;std::string, OpCode&gt;&amp; instruction_set) {
        for (const auto&amp; var : instruction_set) {
            add(var.first, var.second);
        }
    }
} instructions_parser;
</code></pre>

<p><code>OpCode</code>is defined as 
</p>

<pre><code>struct OpCode
{
    std::string mnemonic;
    std::vector&lt;...&gt; variants;// actual type in vector&lt;&gt; not important.
};
</code></pre>

<p>now, with the symbol table embedded in the neccessary rules, when parsing an input string like</p>

<pre><code>mov r2  r1
mov r1  @80
</code></pre>

<p>the resulting ast only contains the first <code>mov</code> with its operands.
The second mov is missing but the operands are correctly parsed.
This may look as followed, when printing the resulting AST:</p>

<pre><code>mov r2 r1 
    r1 @80
</code></pre>

<p>With the debugger I located the source of the error in symbols.hpp in <code>symbol_parser::parse()</code>:
</p>

<pre><code>template &lt;typename Iterator, typename Context, typename Attribute&gt;
    bool parse(Iterator&amp; first, Iterator const&amp; last
      , Context const&amp; context, unused_type, Attribute&amp; attr) const
    {
        x3::skip_over(first, last, context);

        if (value_type* val_ptr
            = lookup-&gt;find(first, last, get_case_compare&lt;Encoding&gt;(context)))
        {
            x3::traits::move_to(*val_ptr, attr); //&lt;- the error originates from here
            return true;
        }
        return false;
    }
</code></pre>

<p>with <code>move_to</code> beeing:
</p>

<pre><code>template &lt;typename T&gt;
inline void move_to(T&amp; src, T&amp; dest)
{
    if (boost::addressof(src) != boost::addressof(dest))
        dest = std::move(src);
}
</code></pre>

<p>As you can see, the <code>src</code> which is my OpCode instance added in the symbol_parser is moved. This means after the first call its empty again and that's why only the first instructions appears. It's, simply put, moved out of the symbol table.</p>

<p><strong>Now finally my question:</strong>
Is this a bug or am I making a mistake?</p>