Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert an mpl sequence of sequences into a trie
    primarykey
    data
    text
    <p>The problem looks simple enough, basically I have a sequence of sequences, something like:</p> <pre><code>typedef mpl::vector&lt; mpl::vector&lt;mpl::_1, mpl::_2&gt;, mpl::vector&lt;mpl::_1, mpl::_2, mpl::_3&gt;, mpl::vector&lt;mpl::_2, mpl::_1&gt;, mpl::vector&lt;mpl::_2, mpl::_2&gt;, mpl::vector&lt;mpl::_2, mpl::_2, mpl::_3&gt; &gt; seq; </code></pre> <p>What I would like to do is to transform this to a trie, the end result being something like:</p> <pre><code>mpl::map&lt; mpl::pair&lt;mpl::_1, mpl::map&lt; mpl::pair&lt;mpl::_2, mpl::map&lt; mpl::pair&lt;TERMINAL, T&gt;, mpl::pair&lt;mpl::_3, mpl::map&lt; mpl::pair&lt;TERMINAL, T&gt; &gt; &gt; &gt; &gt; &gt; &gt; mpl::pair&lt;mpl::_2, mpl::map&lt; mpl::pair&lt;mpl::_1, mpl::map&lt; mpl::pair&lt;TERMINAL, T&gt; &gt; &gt;, mpl::pair&lt;mpl::_2, mpl::map&lt; mpl::pair&lt;TERMINAL, T&gt;, mpl::pair&lt;mpl::_3, mpl::map&lt; mpl::pair&lt;TERMINAL, T&gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; </code></pre> <p>So, the question is, is this possible (I'm thinking it's not)? If it is possible, which dark spells have I missed?</p> <p>EDIT: In case the above transformation from sequence of sequences to a trie is not clear, let me see if I can state it in plain English (often more difficult.) Basically each sequence within the main sequence is composed of some types (<code>_1</code>, <code>_2</code> etc.) The transformed version is trie where common prefixes are collapsed. May be the attached picture helps..</p> <p><img src="https://i.stack.imgur.com/avKb4.png" alt="resulting tree"></p> <p>EDIT2: Thanks to @Yakk, hopefully now the question is clearer...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload